Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from
Feb 4, 2022

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:

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