-
Couldn't load subscription status.
- Fork 6k
Feature/success code responses #7674
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
base: master
Are you sure you want to change the base?
Changes from all commits
d69c934
0c5929c
5124bd3
bf8ee90
177b0d2
9e384ab
65446af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,14 +158,21 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation | |
| CodegenOperation op = super.fromOperation(path, httpMethod, operation, definitions, swagger); | ||
|
|
||
| if (operation.getResponses() != null && !operation.getResponses().isEmpty()) { | ||
| Response methodResponse = findMethodResponse(operation.getResponses()); | ||
| Map.Entry<String, Response> methodResponse = findMethodResponse(operation.getResponses()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since your are changing stuff in many other generators, did you make sure to generate all theses generators? Does it create any changes to the samples? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this change affects to other generators but only changes code generated for java play framework, because |
||
|
|
||
| if (methodResponse != null) { | ||
| if (methodResponse.getSchema() != null) { | ||
| CodegenProperty cm = fromProperty("response", methodResponse.getSchema()); | ||
| op.vendorExtensions.put("x-codegen-response", cm); | ||
| if(cm.datatype == "HttpContent") { | ||
| op.vendorExtensions.put("x-codegen-response-ishttpcontent", true); | ||
| String successCode = methodResponse.getKey(); | ||
| if (!"default".equals(successCode)) { | ||
| op.successCode = Integer.parseInt(successCode); | ||
| } | ||
| Response response = methodResponse.getValue(); | ||
| if (response != null) { | ||
| if (response.getSchema() != null) { | ||
| CodegenProperty cm = fromProperty("response", response.getSchema()); | ||
| op.vendorExtensions.put("x-codegen-response", cm); | ||
| if ("HttpContent".equals(cm.datatype)) { | ||
| op.vendorExtensions.put("x-codegen-response-ishttpcontent", true); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
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 I understand your code correctly, this seems to be a change to the CORE of swagger codegen since it change the way we handle return status. At the beginning, I though it was only Play Framework generator that was missing feature to return the good code but since you needed to add stuff in the DefaultCodegen, I guess it was missing from all codegen.
That is making this change request more important and I think that core members should review it too.
@wing328 Can you check this and also tag some core members to review this.
Thanks!