Java Code Examples for io.swagger.jaxrs.config.BeanConfig#scanAndRead()

The following examples show how to use io.swagger.jaxrs.config.BeanConfig#scanAndRead() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LogSearchDocumentationGenerator.java    From ambari-logsearch with Apache License 2.0 5 votes vote down vote up
private static String generateSwaggerYaml() throws Exception {
  ApiDocConfig apiDocConfig = new ApiDocConfig();
  BeanConfig beanConfig = apiDocConfig.swaggerConfig();
  Swagger swagger = beanConfig.getSwagger();
  swagger.addSecurityDefinition("basicAuth", new BasicAuthDefinition());
  beanConfig.configure(swagger);
  beanConfig.scanAndRead();
  return Yaml.mapper().writeValueAsString(swagger);
}
 
Example 2
Source File: AgentSwaggerConfig.java    From codenvy with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void init(ServletConfig config) throws ServletException {
  try {
    BeanConfig beanConfig = new BeanConfig();
    beanConfig.setVersion("1.0");
    beanConfig.setTitle("Codenvy");
    beanConfig.setBasePath(new URL(agentEndpoint).getPath());
    beanConfig.scanAndRead();
    new SwaggerContextService().withSwaggerConfig(beanConfig).initConfig().initScanner();
  } catch (MalformedURLException e) {
    LOG.warn("Unable to initialize swagger config due to malformed agent URL.", e);
  }
}
 
Example 3
Source File: SwaggerParser.java    From james-project with Apache License 2.0 5 votes vote down vote up
private static BeanConfig getBeanConfig(String packageName, WebAdminConfiguration configuration) {
    BeanConfig beanConfig = new BeanConfig();
    beanConfig.setResourcePackage(packageName);
    beanConfig.setVersion(API_DOC_VERSION);
    beanConfig.setTitle(API_DOC_TITLE);
    beanConfig.setDescription(API_DOC_DESCRIPTION);
    beanConfig.setHost(configuration.getHost() + HOST_PORT_SEPARATOR + configuration.getPort().get().getValue());
    beanConfig.setSchemes(SCHEMES);
    beanConfig.setScan(true);
    beanConfig.scanAndRead();
    return beanConfig;
}