use of io.swagger.v3.oas.integration.api.OpenApiReader in project swagger-core by swagger-api.
the class JaxrsOpenApiContext method buildReader.
@Override
protected OpenApiReader buildReader(OpenAPIConfiguration openApiConfiguration) throws Exception {
OpenApiReader reader;
if (StringUtils.isNotBlank(openApiConfiguration.getReaderClass())) {
Class cls = getClass().getClassLoader().loadClass(openApiConfiguration.getReaderClass());
reader = (OpenApiReader) cls.newInstance();
} else {
reader = new Reader();
}
if (reader instanceof Reader) {
((Reader) reader).setApplication(app);
}
reader.setConfiguration(openApiConfiguration);
return reader;
}
use of io.swagger.v3.oas.integration.api.OpenApiReader in project swagger-core by swagger-api.
the class JaxrsApplicationAndAnnotationScannerTest method shouldScanClassesFromPackages.
@Test(description = "scan a simple resource from packages")
public void shouldScanClassesFromPackages() throws Exception {
SwaggerConfiguration config = new SwaggerConfiguration().resourcePackages(Stream.of("com.my.project.resources", "org.my.project.resources").collect(Collectors.toSet())).openAPI(new OpenAPI().info(new Info().description("TEST INFO DESC")));
OpenApiContext ctx = new GenericOpenApiContext<>().openApiConfiguration(config).openApiReader(new Reader(config)).openApiScanner(scanner.application(null).openApiConfiguration(config)).init();
OpenAPI openApi = ctx.read();
assertNotNull(openApi);
assertEquals(openApi.getPaths().keySet(), Arrays.asList("/packageA", "/packageB"));
}
Aggregations