Search in sources :

Example 31 with Reader

use of io.swagger.jaxrs.Reader in project minijax by minijax.

the class MinijaxSwaggerTest method testJacksonFeatures.

@Test
public void testJacksonFeatures() {
    final Swagger swagger = new Reader(new Swagger()).read(ResourceWithJacksonBean.class);
    final Model o = swagger.getDefinitions().get("JacksonBean");
    assertEquals(Sets.newHashSet("identity", "bean", "code", "message", "precodesuf", "premessagesuf"), o.getProperties().keySet());
}
Also used : Swagger(io.swagger.models.Swagger) Model(io.swagger.models.Model) Reader(io.swagger.jaxrs.Reader) Test(org.junit.Test)

Example 32 with Reader

use of io.swagger.jaxrs.Reader in project minijax by minijax.

the class MinijaxSwaggerTest method scanClassAnfFieldLevelAnnotations.

@Test
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(4, resourceParameters.size());
    assertEquals("fieldParam", getName(resourceParameters, 0));
    assertEquals("skip", getName(resourceParameters, 1));
    assertEquals("limit", getName(resourceParameters, 2));
    assertEquals("methodParam", getName(resourceParameters, 3));
}
Also used : Swagger(io.swagger.models.Swagger) Reader(io.swagger.jaxrs.Reader) HeaderParameter(io.swagger.models.parameters.HeaderParameter) FormParameter(io.swagger.models.parameters.FormParameter) Parameter(io.swagger.models.parameters.Parameter) Test(org.junit.Test)

Example 33 with Reader

use of io.swagger.jaxrs.Reader in project minijax by minijax.

the class ScannerTest method getSwagger.

private Swagger getSwagger(final Class<?> clas) {
    final DefaultReaderConfig config = new DefaultReaderConfig();
    config.setScanAllResources(true);
    return new Reader(new Swagger(), config).read(clas);
}
Also used : Swagger(io.swagger.models.Swagger) Reader(io.swagger.jaxrs.Reader) DefaultReaderConfig(io.swagger.jaxrs.config.DefaultReaderConfig)

Aggregations

Reader (io.swagger.jaxrs.Reader)33 Swagger (io.swagger.models.Swagger)31 Test (org.testng.annotations.Test)20 Parameter (io.swagger.models.parameters.Parameter)7 QueryParameter (io.swagger.models.parameters.QueryParameter)5 DefaultReaderConfig (io.swagger.jaxrs.config.DefaultReaderConfig)4 Operation (io.swagger.models.Operation)4 FormParameter (io.swagger.models.parameters.FormParameter)4 HeaderParameter (io.swagger.models.parameters.HeaderParameter)4 Test (org.junit.Test)4 Scanner (io.swagger.config.Scanner)3 SwaggerConfig (io.swagger.config.SwaggerConfig)3 Model (io.swagger.models.Model)3 Info (io.swagger.models.Info)2 NicknamedOperation (io.swagger.resources.NicknamedOperation)2 SwaggerDefinition (io.swagger.annotations.SwaggerDefinition)1 JaxrsScanner (io.swagger.jaxrs.config.JaxrsScanner)1 ReaderListener (io.swagger.jaxrs.config.ReaderListener)1 SwaggerContextService (io.swagger.jaxrs.config.SwaggerContextService)1 ArrayModel (io.swagger.models.ArrayModel)1