Skip to content

adds the ability to define error responses on error codes instead of default#167

Merged
baywet merged 7 commits intomasterfrom
feature/error-schema
Feb 4, 2022
Merged

adds the ability to define error responses on error codes instead of default#167
baywet merged 7 commits intomasterfrom
feature/error-schema

Conversation

@baywet
Copy link
Member

@baywet baywet commented Jan 27, 2022

fixes #165

This PR adds a new setting ErrorResponsesAsDefault default true to avoid breaking existing users.

When true, the error responses will only be described as the following

"responses": {
          "200": {
            "$ref": "#/components/responses/ODataCountResponse"
          },
          "default": {
            "$ref": "#/components/responses/error"
          }
        }

When false they'll be described as the following

"responses": {
          "200": {
            "$ref": "#/components/responses/ODataCountResponse"
          },
          "4XX": {
            "$ref": "#/components/responses/error"
          },
          "5XX": {
            "$ref": "#/components/responses/error"
          }
        }

This change is made so client generators can "better understand" what the error payloads look like and generate more accurate SDKs.

@baywet baywet self-assigned this Jan 27, 2022
@baywet baywet added this to the 1.0.10 milestone Jan 27, 2022
@xuzhg
Copy link
Contributor

xuzhg commented Jan 27, 2022

:shipit:

@baywet
Copy link
Member Author

baywet commented Jan 28, 2022

@xuzhg thanks for reviewing.
Holding until I get feedback on that proposal #165 (comment)

baywet and others added 7 commits February 1, 2022 11:26
…t responses

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
…nsions.cs

Co-authored-by: Sam Xu <saxu@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
@baywet
Copy link
Member Author

baywet commented Feb 3, 2022

proposal design was approved and implemented, waiting for final review before merge.

@xuzhg
Copy link
Contributor

xuzhg commented Feb 3, 2022

Looks good to me, of course, if you can make the code alignment for better readability.
:shipit:

@baywet baywet merged commit 7b0f3cd into master Feb 4, 2022
@baywet baywet deleted the feature/error-schema branch February 4, 2022 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

errors description should not be translating to default responses

2 participants