-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
[go] Support for response status code ranges #10075
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
if localVarHTTPResponse.StatusCode >= 500 | ||
{{/is5xx}} | ||
{{/range}} | ||
{{^range}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Shall we remove the following before and after the {{#range}} ... {{/range}}
check?
{{^is1xx}}
{{^is2xx}}
...
{{/is2xx}}
{{/is1xx}}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing those checks causes unreachable code to be generated due to the if localVarHTTPResponse.StatusCode >= 300 {
a few lines up. We're only interested in decoding "unsuccessful" responses at this point and those negative checks are the only way to do this AFAIK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
cc @OpenAPITools/generator-core-team as the change covers the default codegen class |
This PR adds support for response ranges in Go clients, as defined in section 4.8.16.2 of the spec.
This includes a simple response sorting change in
DefaultCodegen.java
(originally introduced by @thiagoarrais) that should make this feature easier to support in all languages.PR checklist
master
,5.3.x
,6.0.x