use of io.swagger.jaxrs.Reader in project swagger-core by swagger-api.
the class FormDataBodyPartTest method testFormDataBodyPart.
@Test(description = "FormDataBodyPart should be ignored when generating the Swagger document")
public void testFormDataBodyPart() {
final Swagger swagger = new Reader(new Swagger()).read(ResourceWithFormData.class);
final List<Parameter> parameters = swagger.getPath("/test/document/{documentName}.json").getPost().getParameters();
assertEquals(parameters.size(), 3);
assertEquals(parameters.get(0).getName(), "documentName");
assertEquals(parameters.get(1).getName(), "input");
assertEquals(parameters.get(2).getName(), "id");
}
use of io.swagger.jaxrs.Reader in project swagger-core by swagger-api.
the class ReaderTest method scanImplicitParamInterfaceTest.
@Test(description = "scan indirect implicit params from interface")
public void scanImplicitParamInterfaceTest() {
final Swagger swagger = new Reader(new Swagger()).read(IndirectImplicitParamsImpl.class);
assertNotNull(swagger);
assertEquals(swagger.getPath("/v1/users/{id}").getGet().getParameters().size(), 2);
}
use of io.swagger.jaxrs.Reader in project swagger-core by swagger-api.
the class ReaderTest method scanInterfaceTest.
@Test(description = "scan annotation from interface, issue#1427")
public void scanInterfaceTest() {
final Swagger swagger = new Reader(new Swagger()).read(AnnotatedInterfaceImpl.class);
assertNotNull(swagger);
assertNotNull(swagger.getPath("/v1/users/{id}").getGet());
}
use of io.swagger.jaxrs.Reader in project swagger-core by swagger-api.
the class SwaggerJersey2JaxrsTest method scanClassAnfFieldLevelAnnotations.
@Test(description = "scan class level and field level annotations")
public void scanClassAnfFieldLevelAnnotations() {
final Swagger swagger = new Reader(new Swagger()).read(ResourceWithKnownInjections.class);
final List<Parameter> resourceParameters = swagger.getPaths().get("/resource/{id}").getGet().getParameters();
assertNotNull(resourceParameters);
assertEquals(resourceParameters.size(), 4);
assertEquals(getName(resourceParameters, 0), "fieldParam");
assertEquals(getName(resourceParameters, 1), "skip");
assertEquals(getName(resourceParameters, 2), "limit");
assertEquals(getName(resourceParameters, 3), "methodParam");
}
use of io.swagger.jaxrs.Reader in project swagger-core by swagger-api.
the class JsonIdentityTest method scan.
@Test(description = "Scan API with operation and response references")
public void scan() throws IOException {
final Swagger swagger = new Reader(new Swagger()).read(JsonIdentityResource.class);
final String json = ResourceUtils.loadClassResource(getClass(), "ResourceWithJsonIdentity.json");
SerializationMatchers.assertEqualsToJson(swagger, json);
}
Aggregations