Search in sources :

Example 6 with Reader

use of io.swagger.jaxrs.Reader in project swagger-core by swagger-api.

the class ReaderTest method scanImplicitParamOverriddenMethodTest.

@Test(description = "scan indirect implicit params from overridden method")
public void scanImplicitParamOverriddenMethodTest() {
    final Swagger swagger = new Reader(new Swagger()).read(IndirectImplicitParamsImpl.class);
    assertNotNull(swagger);
    assertEquals(swagger.getPath("/v1/users").getPost().getParameters().size(), 2);
}
Also used : Swagger(io.swagger.models.Swagger) Reader(io.swagger.jaxrs.Reader) Test(org.testng.annotations.Test)

Example 7 with Reader

use of io.swagger.jaxrs.Reader in project cxf by apache.

the class Java2SwaggerMojo method loadSwaggerAnnotation.

private void loadSwaggerAnnotation() throws MojoExecutionException {
    Reader reader = new Reader(swagger);
    swagger = reader.read(loadResourceClasses(Api.class));
}
Also used : Reader(io.swagger.jaxrs.Reader)

Example 8 with Reader

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

the class MinijaxSwaggerTest method testIssue2031.

@Test
public void testIssue2031() {
    final Swagger swagger = new Reader(new Swagger()).read(Resource2031.class);
    assertNotNull(swagger);
}
Also used : Swagger(io.swagger.models.Swagger) Reader(io.swagger.jaxrs.Reader) Test(org.junit.Test)

Example 9 with Reader

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

the class MinijaxSwaggerTest method testFormDataBodyPart.

@Test
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(5, parameters.size());
    assertEquals("documentName", parameters.get(0).getName());
    assertEquals("document", parameters.get(1).getName());
    assertEquals("document2", parameters.get(2).getName());
    assertEquals("input", parameters.get(3).getName());
    assertEquals("id", parameters.get(4).getName());
}
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 10 with Reader

use of io.swagger.jaxrs.Reader in project apiee by phillip-kruger.

the class SwaggerCache method createSwagger.

private Swagger createSwagger(final Set<Class<?>> classes, final URL url) {
    Swagger swagger = new Reader(new Swagger()).read(classes);
    Info info = getSwaggerInfo();
    if (info != null)
        swagger.setInfo(info);
    String consumes = whiteLabel.getProperty(CONSUMES, null);
    if (isSet(consumes))
        swagger.setConsumes(toList(consumes));
    String produces = whiteLabel.getProperty(PRODUCES, null);
    if (isSet(produces))
        swagger.setProduces(toList(produces));
    String basePath = whiteLabel.getProperty(BASE_PATH, getBasePath(swagger.getBasePath(), url));
    if (isSet(basePath))
        swagger.setBasePath(basePath);
    String schemes = whiteLabel.getProperty(SCHEMES, url.getProtocol().toUpperCase());
    if (isSet(schemes))
        swagger.setSchemes(toSchemeList(schemes));
    String host = whiteLabel.getProperty(HOST, url.getHost() + DOUBLE_POINT + url.getPort());
    if (isSet(host))
        swagger.setHost(host);
    String tags = whiteLabel.getProperty(TAGS, null);
    if (isSet(tags))
        swagger.setTags(toTagList(tags));
    return swagger;
}
Also used : Swagger(io.swagger.models.Swagger) Reader(io.swagger.jaxrs.Reader) Info(io.swagger.models.Info)

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