-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Do not check status code for default response #3322
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -595,6 +595,25 @@ public void testLeadingSlashIsAddedIfMissing() { | |
| Assert.assertEquals(co2.path, "/some/path"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testDefaultResponseShouldBeLast() { | ||
| OpenAPI openAPI = TestUtils.createOpenAPI(); | ||
| Operation myOperation = new Operation().operationId("myOperation").responses( | ||
| new ApiResponses() | ||
| .addApiResponse( | ||
| "default", new ApiResponse().description("Default")) | ||
| .addApiResponse( | ||
| "422", new ApiResponse().description("Error")) | ||
|
Member
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. @thiagoarrais I notice that you've updated the test to replace 2xx with 4xx status code. Does it mean the original "201" status code test fail?
Contributor
Author
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. No. 422 just seemed more realistic. 201 is a success and more likely to be equated to the default case. |
||
| ); | ||
| openAPI.path("/here", new PathItem().get(myOperation)); | ||
| final DefaultCodegen codegen = new DefaultCodegen(); | ||
| codegen.setOpenAPI(openAPI); | ||
|
|
||
| CodegenOperation co = codegen.fromOperation("/here", "get", myOperation, null); | ||
| Assert.assertEquals(co.responses.get(0).message, "Error"); | ||
| Assert.assertEquals(co.responses.get(1).message, "Default"); | ||
| } | ||
|
|
||
| @Test | ||
| public void testResponseWithNoSchemaInHeaders() { | ||
| OpenAPI openAPI = TestUtils.createOpenAPI(); | ||
|
|
||
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.
Changes in DefaultCodegen
cc @OpenAPITools/generator-core-team