use of io.swagger.jaxrs.Reader in project swagger-core by swagger-api.
the class ScannerTest method getSwagger.
private Swagger getSwagger(Class<?> clas) {
DefaultReaderConfig config = new DefaultReaderConfig();
config.setScanAllResources(true);
return new Reader(new Swagger(), config).read(clas);
}
use of io.swagger.jaxrs.Reader in project swagger-core by swagger-api.
the class SwaggerJersey2JaxrsTest method testIssue2031.
@Test(description = "Tests issue 2031")
public void testIssue2031() {
final Swagger swagger = new Reader(new Swagger()).read(Resource2031.class);
assertNotNull(swagger);
}
use of io.swagger.jaxrs.Reader in project swagger-core by swagger-api.
the class ApiListingJSON method scan.
protected synchronized void scan(Application app) {
Scanner scanner = ScannerFactory.getScanner();
LOGGER.debug("using scanner " + scanner);
if (scanner != null) {
SwaggerSerializers.setPrettyPrint(scanner.getPrettyPrint());
Set<Class<?>> classes = null;
classes = scanner.classes();
if (classes != null) {
Reader reader = new Reader(swagger);
swagger = reader.read(classes);
if (scanner instanceof SwaggerConfig) {
swagger = ((SwaggerConfig) scanner).configure(swagger);
}
}
}
initialized = true;
}
use of io.swagger.jaxrs.Reader in project ORCID-Source by ORCID.
the class SwaggerJSONResource method scan.
protected synchronized Swagger scan(Application app) {
Swagger swagger = null;
Scanner scanner = ScannerFactory.getScanner();
ModelConverters.getInstance().addConverter(new SwaggerModelConverter());
LOGGER.debug("[SWAGGER] using scanner " + scanner);
if (scanner != null) {
SwaggerSerializers.setPrettyPrint(scanner.getPrettyPrint());
swagger = (Swagger) context.getAttribute("swagger");
Set<Class<?>> classes = scanner.classes();
if (classes != null) {
Reader reader = new Reader(swagger, ReaderConfigUtils.getReaderConfig(context));
swagger = reader.read(classes);
if (scanner instanceof SwaggerConfig) {
swagger = ((SwaggerConfig) scanner).configure(swagger);
} else {
SwaggerConfig configurator = (SwaggerConfig) context.getAttribute("reader");
if (configurator != null) {
LOGGER.debug("configuring swagger with " + configurator);
configurator.configure(swagger);
} else {
LOGGER.debug("no configurator");
}
}
context.setAttribute("swagger", swagger);
}
}
initialized = true;
return swagger;
}
use of io.swagger.jaxrs.Reader in project gravitee-management-rest-api by gravitee-io.
the class GraviteeApiDefinition method afterScan.
@Override
public void afterScan(Reader reader, Swagger swagger) {
swagger.addSecurityDefinition(TOKEN_AUTH_SCHEME, new BasicAuthDefinition());
swagger.getPaths().values().stream().forEach(path -> path.getOperations().stream().forEach(operation -> operation.addSecurity(GraviteeApiDefinition.TOKEN_AUTH_SCHEME, null)));
}
Aggregations