use of io.swagger.models.Response in project incubator-servicecomb-java-chassis by apache.
the class TestApiResponse method checkMulti.
public void checkMulti(SwaggerGenerator generator) {
Swagger swagger = generator.getSwagger();
Path path = swagger.getPaths().get("/testMulti");
Operation operation = path.getOperations().get(0);
Assert.assertEquals("testMulti", operation.getOperationId());
Response response = operation.getResponses().get("200");
Assert.assertEquals(Integer.class, ConverterMgr.findJavaType(generator, response.getSchema()).getRawClass());
response = operation.getResponses().get("301");
Assert.assertEquals(String.class, ConverterMgr.findJavaType(generator, response.getSchema()).getRawClass());
}
use of io.swagger.models.Response in project incubator-servicecomb-java-chassis by apache.
the class TestApiResponse method checkResponseHeader.
private void checkResponseHeader(SwaggerGenerator generator) {
Swagger swagger = generator.getSwagger();
Path path = swagger.getPaths().get("/testResponseHeader");
Operation operation = path.getOperations().get(0);
Assert.assertEquals("testResponseHeader", operation.getOperationId());
Response response = operation.getResponses().get("200");
Property property = response.getHeaders().get("k1");
Assert.assertEquals(Integer.class, ConverterMgr.findJavaType(generator, property).getRawClass());
}
use of io.swagger.models.Response in project incubator-servicecomb-java-chassis by apache.
the class TestApiResponse method checkResponseDesc.
private void checkResponseDesc(SwaggerGenerator generator) {
Swagger swagger = generator.getSwagger();
Path path = swagger.getPaths().get("/testMulti");
Operation operation = path.getOperations().get(0);
Response response1 = operation.getResponses().get("200");
Response response2 = operation.getResponses().get("301");
Assert.assertEquals("msg1", response1.getDescription());
Assert.assertEquals("msg2", response2.getDescription());
}
use of io.swagger.models.Response in project incubator-servicecomb-java-chassis by apache.
the class TestApiResponse method checkApiResponseHeader.
private void checkApiResponseHeader(SwaggerGenerator generator) {
Swagger swagger = generator.getSwagger();
Path path = swagger.getPaths().get("/testApiResponseHeader");
Operation operation = path.getOperations().get(0);
Assert.assertEquals("testApiResponseHeader", operation.getOperationId());
Response response = operation.getResponses().get("200");
Property property = response.getHeaders().get("k1");
Assert.assertEquals(Integer.class, ConverterMgr.findJavaType(generator, property).getRawClass());
property = response.getHeaders().get("k2");
Assert.assertEquals(String.class, ConverterMgr.findJavaType(generator, property).getRawClass());
}
use of io.swagger.models.Response in project incubator-servicecomb-java-chassis by apache.
the class TestSwaggerUtils method correctResponsesOperationDefaultTo200.
@Test
public void correctResponsesOperationDefaultTo200() {
Response response = new Response();
Operation operation = new Operation();
operation.addResponse("default", response);
SwaggerUtils.correctResponses(operation);
Assert.assertSame(response, operation.getResponses().get("200"));
}
Aggregations