mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-03-22 09:30:02 +00:00
Do not check status code for default response (#3322)
* Do not check status code for default response * Updated generated code/docs Because Circle CI said > Please run 'bin/utils/ensure-up-to-date' locally and commit > changes (UNCOMMITTED CHANGES ERROR)
This commit is contained in:
committed by
William Cheng
parent
2cab048d41
commit
cb2bf4d2bf
@@ -595,6 +595,25 @@ public class DefaultCodegenTest {
|
||||
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"))
|
||||
);
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user