Skip to content

Commit

Permalink
refactor(sdk): rename errors
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Error models in the generated SDK have been renamed:

```patch
- oAuth2ApiError
+ errorOAuth2
```
  • Loading branch information
aeneasr committed Oct 11, 2022
1 parent cb742ad commit 6b60156
Show file tree
Hide file tree
Showing 22 changed files with 625 additions and 2,120 deletions.
28 changes: 14 additions & 14 deletions client/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ type createOAuth2Client struct {
//
// Responses:
// 201: oAuth2Client
// 400: errorBadRequest
// default: errorDefault
// 400: errorOAuth2BadRequest
// default: errorOAuth2Default
func (h *Handler) createOAuth2Client(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
c, err := h.CreateClient(r, h.r.ClientValidator().Validate, false)
if err != nil {
Expand Down Expand Up @@ -158,8 +158,8 @@ type createOidcDynamicClient struct {
//
// Responses:
// 201: oAuth2Client
// 400: errorBadRequest
// default: errorDefault
// 400: errorOAuth2BadRequest
// default: errorOAuth2Default
func (h *Handler) createOidcDynamicClient(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
if err := h.requireDynamicAuth(r); err != nil {
h.r.Writer().WriteError(w, r, err)
Expand Down Expand Up @@ -267,9 +267,9 @@ type setOAuth2Client struct {
//
// Responses:
// 200: oAuth2Client
// 400: errorBadRequest
// 404: errorNotFound
// default: errorDefault
// 400: errorOAuth2BadRequest
// 404: errorOAuth2NotFound
// default: errorOAuth2Default
func (h *Handler) setOAuth2Client(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
var c Client
if err := json.NewDecoder(r.Body).Decode(&c); err != nil {
Expand Down Expand Up @@ -354,8 +354,8 @@ type setOidcDynamicClient struct {
//
// Responses:
// 200: oAuth2Client
// 404: errorNotFound
// default: errorDefault
// 404: errorOAuth2NotFound
// default: errorOAuth2Default
func (h *Handler) setOidcDynamicClient(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
if err := h.requireDynamicAuth(r); err != nil {
h.r.Writer().WriteError(w, r, err)
Expand Down Expand Up @@ -435,8 +435,8 @@ type patchOAuth2Client struct {
//
// Responses:
// 200: oAuth2Client
// 404: errorNotFound
// default: errorDefault
// 404: errorOAuth2NotFound
// default: errorOAuth2Default
func (h *Handler) patchOAuth2Client(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
patchJSON, err := io.ReadAll(r.Body)
if err != nil {
Expand Down Expand Up @@ -520,7 +520,7 @@ type listOAuth2ClientsParameters struct {
//
// Responses:
// 200: listOAuth2Clients
// default: errorDefault
// default: errorOAuth2Default
func (h *Handler) listOAuth2Clients(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
page, itemsPerPage := x.ParsePagination(r)
filters := Filter{
Expand Down Expand Up @@ -584,7 +584,7 @@ type adminGetOAuth2Client struct {
//
// Responses:
// 200: oAuth2Client
// default: errorDefault
// default: errorOAuth2Default
func (h *Handler) Get(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
var id = ps.ByName("id")
c, err := h.r.ClientManager().GetConcreteClient(r.Context(), id)
Expand Down Expand Up @@ -633,7 +633,7 @@ type getOidcDynamicClient struct {
//
// Responses:
// 200: oAuth2Client
// default: errorDefault
// default: errorOAuth2Default
func (h *Handler) getOidcDynamicClient(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
if err := h.requireDynamicAuth(r); err != nil {
h.r.Writer().WriteError(w, r, err)
Expand Down
24 changes: 12 additions & 12 deletions consent/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ type adminRevokeOAuth2ConsentSessions struct {
//
// Responses:
// 204: emptyResponse
// default: oAuth2ApiError
// default: errorOAuth2
func (h *Handler) adminRevokeOAuth2ConsentSessions(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
subject := r.URL.Query().Get("subject")
client := r.URL.Query().Get("client")
Expand Down Expand Up @@ -177,7 +177,7 @@ type adminListOAuth2SubjectConsentSessions struct {
//
// Responses:
// 200: previousOAuth2ConsentSessions
// default: oAuth2ApiError
// default: errorOAuth2
func (h *Handler) adminListOAuth2SubjectConsentSessions(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
subject := r.URL.Query().Get("subject")
if subject == "" {
Expand Down Expand Up @@ -242,7 +242,7 @@ type adminRevokeOAuth2LoginSessions struct {
//
// Responses:
// 204: emptyResponse
// default: oAuth2ApiError
// default: errorOAuth2
func (h *Handler) adminRevokeOAuth2LoginSessions(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
subject := r.URL.Query().Get("subject")
if subject == "" {
Expand Down Expand Up @@ -288,7 +288,7 @@ type adminGetOAuth2LoginRequest struct {
// Responses:
// 200: oAuth2LoginRequest
// 410: handledOAuth2LoginRequest
// default: oAuth2ApiError
// default: errorOAuth2
func (h *Handler) adminGetOAuth2LoginRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := stringsx.Coalesce(
r.URL.Query().Get("login_challenge"),
Expand Down Expand Up @@ -354,7 +354,7 @@ type adminAcceptOAuth2LoginRequest struct {
//
// Responses:
// 200: successfulOAuth2RequestResponse
// default: oAuth2ApiError
// default: errorOAuth2
func (h *Handler) adminAcceptOAuth2LoginRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := stringsx.Coalesce(
r.URL.Query().Get("login_challenge"),
Expand Down Expand Up @@ -453,7 +453,7 @@ type adminRejectOAuth2LoginRequest struct {
//
// Responses:
// 200: successfulOAuth2RequestResponse
// default: oAuth2ApiError
// default: errorOAuth2
func (h *Handler) adminRejectOAuth2LoginRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := stringsx.Coalesce(
r.URL.Query().Get("login_challenge"),
Expand Down Expand Up @@ -534,7 +534,7 @@ type adminGetOAuth2ConsentRequest struct {
// Responses:
// 200: oAuth2ConsentRequest
// 410: handledOAuth2ConsentRequest
// default: oAuth2ApiError
// default: errorOAuth2
func (h *Handler) adminGetOAuth2ConsentRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := stringsx.Coalesce(
r.URL.Query().Get("consent_challenge"),
Expand Down Expand Up @@ -610,7 +610,7 @@ type adminAcceptOAuth2ConsentRequest struct {
//
// Responses:
// 200: successfulOAuth2RequestResponse
// default: oAuth2ApiError
// default: errorOAuth2
func (h *Handler) adminAcceptOAuth2ConsentRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := stringsx.Coalesce(
r.URL.Query().Get("consent_challenge"),
Expand Down Expand Up @@ -698,7 +698,7 @@ type adminRejectOAuth2ConsentRequest struct {
//
// Responses:
// 200: successfulOAuth2RequestResponse
// default: oAuth2ApiError
// default: errorOAuth2
func (h *Handler) adminRejectOAuth2ConsentRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := stringsx.Coalesce(
r.URL.Query().Get("consent_challenge"),
Expand Down Expand Up @@ -769,7 +769,7 @@ type adminAcceptOAuth2LogoutRequest struct {
//
// Responses:
// 200: successfulOAuth2RequestResponse
// default: oAuth2ApiError
// default: errorOAuth2
func (h *Handler) adminAcceptOAuth2LogoutRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := stringsx.Coalesce(
r.URL.Query().Get("logout_challenge"),
Expand Down Expand Up @@ -813,7 +813,7 @@ type adminRejectOAuth2LogoutRequest struct {
//
// Responses:
// 204: emptyResponse
// default: oAuth2ApiError
// default: errorOAuth2
func (h *Handler) adminRejectOAuth2LogoutRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := stringsx.Coalesce(
r.URL.Query().Get("logout_challenge"),
Expand Down Expand Up @@ -849,7 +849,7 @@ type adminGetOAuth2LogoutRequest struct {
// Responses:
// 200: oAuth2LogoutRequest
// 410: handledOAuth2LogoutRequest
// default: oAuth2ApiError
// default: errorOAuth2
func (h *Handler) adminGetOAuth2LogoutRequest(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
challenge := stringsx.Coalesce(
r.URL.Query().Get("logout_challenge"),
Expand Down
4 changes: 2 additions & 2 deletions health/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package health
//
// Responses:
// 200: healthStatus
// 500: oAuth2ApiError
// 500: errorOAuth2
func swaggerPublicIsInstanceAlive() {}

// Alive returns an ok status if the instance is ready to handle HTTP requests.
Expand All @@ -43,7 +43,7 @@ func swaggerPublicIsInstanceAlive() {}
//
// Responses:
// 200: healthStatus
// 500: oAuth2ApiError
// 500: errorOAuth2
func swaggerAdminIsInstanceAlive() {}

// Ready returns an ok status if the instance is ready to handle HTTP requests and all ReadyCheckers are ok.
Expand Down
8 changes: 2 additions & 6 deletions internal/httpclient/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ docs/AcceptOAuth2ConsentRequestSession.md
docs/AcceptOAuth2LoginRequest.md
docs/AdminCreateJsonWebKeySetBody.md
docs/AdminTrustOAuth2JwtGrantIssuerBody.md
docs/ErrorBody.md
docs/ErrorOAuth2.md
docs/GenericError.md
docs/GetVersion200Response.md
docs/HandledOAuth2ConsentRequest.md
Expand All @@ -31,9 +31,7 @@ docs/JsonPatch.md
docs/JsonWebKey.md
docs/JsonWebKeySet.md
docs/MetadataApi.md
docs/ModelError.md
docs/OAuth2AccessRequest.md
docs/OAuth2ApiError.md
docs/OAuth2Client.md
docs/OAuth2ClientTokenLifespans.md
docs/OAuth2ConsentRequest.md
Expand Down Expand Up @@ -70,8 +68,7 @@ model_accept_o_auth2_consent_request_session.go
model_accept_o_auth2_login_request.go
model_admin_create_json_web_key_set_body.go
model_admin_trust_o_auth2_jwt_grant_issuer_body.go
model_error.go
model_error_body.go
model_error_o_auth2.go
model_generic_error.go
model_get_version_200_response.go
model_handled_o_auth2_consent_request.go
Expand All @@ -88,7 +85,6 @@ model_json_patch.go
model_json_web_key.go
model_json_web_key_set.go
model_o_auth2_access_request.go
model_o_auth2_api_error.go
model_o_auth2_client.go
model_o_auth2_client_token_lifespans.go
model_o_auth2_consent_request.go
Expand Down
4 changes: 1 addition & 3 deletions internal/httpclient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ All URIs are relative to _http://localhost_
- [AcceptOAuth2LoginRequest](docs/AcceptOAuth2LoginRequest.md)
- [AdminCreateJsonWebKeySetBody](docs/AdminCreateJsonWebKeySetBody.md)
- [AdminTrustOAuth2JwtGrantIssuerBody](docs/AdminTrustOAuth2JwtGrantIssuerBody.md)
- [ErrorBody](docs/ErrorBody.md)
- [ErrorOAuth2](docs/ErrorOAuth2.md)
- [GenericError](docs/GenericError.md)
- [GetVersion200Response](docs/GetVersion200Response.md)
- [HandledOAuth2ConsentRequest](docs/HandledOAuth2ConsentRequest.md)
Expand All @@ -159,9 +159,7 @@ All URIs are relative to _http://localhost_
- [JsonPatch](docs/JsonPatch.md)
- [JsonWebKey](docs/JsonWebKey.md)
- [JsonWebKeySet](docs/JsonWebKeySet.md)
- [ModelError](docs/ModelError.md)
- [OAuth2AccessRequest](docs/OAuth2AccessRequest.md)
- [OAuth2ApiError](docs/OAuth2ApiError.md)
- [OAuth2Client](docs/OAuth2Client.md)
- [OAuth2ClientTokenLifespans](docs/OAuth2ClientTokenLifespans.md)
- [OAuth2ConsentRequest](docs/OAuth2ConsentRequest.md)
Expand Down
Loading

0 comments on commit 6b60156

Please sign in to comment.