use of io.swagger.models.Operation in project java-chassis by ServiceComb.
the class TestApiImplicitParams method testBody.
@Test
public void testBody() {
SwaggerGenerator swaggerGenerator = new SwaggerGeneratorForTest(context, ApiImplicitParamsAnnotation.class);
swaggerGenerator.generate();
Swagger swagger = swaggerGenerator.getSwagger();
Path path = swagger.getPaths().get("/testBody");
Operation operation = path.getOperations().get(0);
Parameter parameter = operation.getParameters().get(0);
JavaType javaType = ConverterMgr.findJavaType(swaggerGenerator, parameter);
Assert.assertEquals(User.class, javaType.getRawClass());
}
use of io.swagger.models.Operation in project java-chassis by ServiceComb.
the class TestApiOperation method testMap.
private void testMap(Path path) {
Operation operation = path.getPost();
Property result200 = operation.getResponses().get("200").getSchema();
Assert.assertEquals(MapProperty.class, result200.getClass());
}
use of io.swagger.models.Operation in project java-chassis by ServiceComb.
the class TestApiOperation method testSet.
private void testSet(Path path) {
Operation operation = path.getPost();
Property result200 = operation.getResponses().get("200").getSchema();
Assert.assertEquals(ArrayProperty.class, result200.getClass());
Assert.assertEquals(true, ((ArrayProperty) result200).getUniqueItems());
}
use of io.swagger.models.Operation in project java-chassis by ServiceComb.
the class TestApiOperation method testPrimitive.
private void testPrimitive(Path path) {
Operation operation = path.getPost();
Assert.assertEquals(2, operation.getResponses().size());
Property result200 = operation.getResponses().get("200").getSchema();
Assert.assertEquals("integer", result200.getType());
Assert.assertEquals("int32", result200.getFormat());
Property result202 = operation.getResponses().get("202").getSchema();
Assert.assertEquals("string", result202.getType());
Assert.assertEquals(null, result202.getFormat());
}
use of io.swagger.models.Operation in project java-chassis by ServiceComb.
the class RequestMappingMethodAnnotationProcessor method process.
@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
RequestMapping requestMapping = (RequestMapping) annotation;
Operation operation = operationGenerator.getOperation();
// path/value是等同的
this.processPath(requestMapping.path(), operationGenerator);
this.processPath(requestMapping.value(), operationGenerator);
this.processMethod(requestMapping.method(), operationGenerator);
this.processConsumes(requestMapping.consumes(), operation);
this.processProduces(requestMapping.produces(), operation);
}
Aggregations