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:
Thiago Arrais
2019-10-14 14:29:46 -03:00
committed by William Cheng
parent 2cab048d41
commit cb2bf4d2bf
56 changed files with 377 additions and 219 deletions

View File

@@ -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();