use of io.swagger.jaxrs.Reader in project swagger-core by swagger-api.
the class OverriddenTypeTests method passwordParameterTest.
@Test(description = "add a user-specified format")
public void passwordParameterTest() {
Swagger swagger = new Reader(new Swagger()).read(Resource469.class);
QueryParameter qp = (QueryParameter) swagger.getPath("/test").getGet().getParameters().get(0);
assertEquals(qp.getFormat(), "password");
}
use of io.swagger.jaxrs.Reader in project swagger-core by swagger-api.
the class SimpleReaderTest method scanSimpleSelfReferencingSubResource.
@Test(description = "scan a simple self-referencing subresource")
public void scanSimpleSelfReferencingSubResource() {
DefaultReaderConfig config = new DefaultReaderConfig();
config.setScanAllResources(true);
Swagger swagger = new Reader(new Swagger(), config).read(SimpleSelfReferencingSubResource.class);
assertEquals(swagger.getPaths().size(), 4);
// these two paths are directly reachable without passing thru a recursive reference
Operation retrieve = getGet(swagger, "/sub");
assertNotNull(retrieve);
assertEquals(retrieve.getParameters().size(), 0);
retrieve = getGet(swagger, "/sub/leaf");
assertNotNull(retrieve);
assertEquals(retrieve.getParameters().size(), 0);
retrieve = getGet(swagger, "/sub/recurse2");
assertNotNull(retrieve);
assertEquals(retrieve.getParameters().size(), 0);
retrieve = getGet(swagger, "/sub/recurse2/leaf");
assertNotNull(retrieve);
assertEquals(retrieve.getParameters().size(), 0);
}
use of io.swagger.jaxrs.Reader in project swagger-core by swagger-api.
the class ReaderTest method scanMethods.
@Test(description = "scan methods")
public void scanMethods() {
Method[] methods = SimpleMethods.class.getMethods();
Reader reader = new Reader(new Swagger());
for (Method method : methods) {
if (isValidRestPath(method)) {
Operation operation = reader.parseMethod(method);
assertNotNull(operation);
}
}
}
use of io.swagger.jaxrs.Reader in project swagger-core by swagger-api.
the class SwaggerJersey2JaxrsTest 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 SwaggerJersey2JaxrsTest method testJacksonFeatures.
@Test(description = "JsonUnwrapped, JsonIgnore, JsonValue should be honoured")
public void testJacksonFeatures() {
final Swagger swagger = new Reader(new Swagger()).read(ResourceWithJacksonBean.class);
Model o = swagger.getDefinitions().get("JacksonBean");
assertEquals(o.getProperties().keySet(), Sets.newHashSet("identity", "bean", "code", "message", "precodesuf", "premessagesuf"));
}
Aggregations