Search in sources :

Example 26 with BeanConfig

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

the class SwaggerContextServiceTest method initMock.

@BeforeMethod
void initMock() {
    servletContext1 = mock(ServletContext.class);
    servletConfig1 = mock(ServletConfig.class);
    servletContext2 = mock(ServletContext.class);
    servletConfig2 = mock(ServletConfig.class);
    jaxrsScanner = new DefaultJaxrsScanner();
    BeanConfig bc = new BeanConfig();
    bc.setDescription("Bean Config test 1");
    beanConfigScanner1 = bc;
    bc = new BeanConfig();
    bc.setDescription("Bean Config test 2");
    beanConfigScanner2 = bc;
}
Also used : BeanConfig(io.swagger.jaxrs.config.BeanConfig) DefaultJaxrsScanner(io.swagger.jaxrs.config.DefaultJaxrsScanner) ServletConfig(javax.servlet.ServletConfig) ServletContext(javax.servlet.ServletContext) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 27 with BeanConfig

use of io.swagger.jaxrs.config.BeanConfig in project metacat by Netflix.

the class ApiConfig method swaggerBeanConfig.

/**
     * Swagger configuration.
     *
     * @param config The application configuration abstraction
     * @return Swagger bean configuration
     */
@Bean
public BeanConfig swaggerBeanConfig(final Config config) {
    final BeanConfig beanConfig = new BeanConfig();
    // TODO: put this back and remove hard coding
    //        beanConfig.setVersion(config.getMetacatVersion());
    beanConfig.setVersion("1.1.0");
    beanConfig.setBasePath("/mds");
    beanConfig.setResourcePackage("com.netflix.metacat");
    beanConfig.setScan(true);
    return beanConfig;
}
Also used : BeanConfig(io.swagger.jaxrs.config.BeanConfig) Bean(org.springframework.context.annotation.Bean)

Example 28 with BeanConfig

use of io.swagger.jaxrs.config.BeanConfig in project api-core by ca-cwds.

the class BaseApiApplication method configureSwagger.

private void configureSwagger(final T apiConfiguration, final Environment environment) {
    BeanConfig config = new BeanConfig();
    SwaggerConfiguration swaggerConfiguration = apiConfiguration.getSwaggerConfiguration();
    config.setTitle(swaggerConfiguration.getTitle());
    config.setDescription(swaggerConfiguration.getDescription());
    config.setResourcePackage(swaggerConfiguration.getResourcePackage());
    config.setScan(true);
    new AssetsBundle(swaggerConfiguration.getAssetsPath(), swaggerConfiguration.getAssetsPath(), null, "swagger").run(environment);
    LOGGER.info("Registering ApiListingResource");
    environment.jersey().register(new ApiListingResource());
    LOGGER.info("Registering SwaggerResource");
    SwaggerResource swaggerResource = new SwaggerResource(swaggerConfiguration);
    environment.jersey().register(swaggerResource);
    if (swaggerConfiguration.isShowSwagger()) {
        TokenResource tokenResource = new TokenResource(swaggerConfiguration);
        environment.jersey().register(tokenResource);
    }
}
Also used : BeanConfig(io.swagger.jaxrs.config.BeanConfig) SwaggerResource(gov.ca.cwds.rest.resources.SwaggerResource) TokenResource(gov.ca.cwds.rest.resources.TokenResource) AssetsBundle(io.dropwizard.assets.AssetsBundle) ApiListingResource(io.swagger.jaxrs.listing.ApiListingResource)

Example 29 with BeanConfig

use of io.swagger.jaxrs.config.BeanConfig in project teiid by teiid.

the class BootstrapServlet method init.

@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    BeanConfig beanConfig = new BeanConfig();
    init(beanConfig);
}
Also used : BeanConfig(io.swagger.jaxrs.config.BeanConfig)

Example 30 with BeanConfig

use of io.swagger.jaxrs.config.BeanConfig in project Gaffer by gchq.

the class ApplicationConfigV1 method setupBeanConfig.

@Override
protected void setupBeanConfig() {
    final BeanConfig beanConfig = new BeanConfig();
    String basePath = System.getProperty(SystemProperty.BASE_PATH, SystemProperty.BASE_PATH_DEFAULT);
    if (!basePath.startsWith("/")) {
        basePath = "/" + basePath;
    }
    beanConfig.setBasePath(basePath + '/' + VERSION);
    beanConfig.setConfigId(VERSION);
    beanConfig.setScannerId(VERSION);
    beanConfig.setResourcePackage("uk.gov.gchq.gaffer.rest.service.v1");
    beanConfig.setScan(true);
}
Also used : BeanConfig(io.swagger.jaxrs.config.BeanConfig)

Aggregations

BeanConfig (io.swagger.jaxrs.config.BeanConfig)31 Swagger (io.swagger.models.Swagger)9 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)7 DefaultClassResolver (org.apache.camel.impl.DefaultClassResolver)7 Test (org.junit.Test)7 Test (org.testng.annotations.Test)3 ApiListingResource (io.swagger.jaxrs.listing.ApiListingResource)2 SplitResourceImpl (com.splitresourcesTestImpl.SplitResourceImpl)1 RootResource (com.subresourcesTest.RootResource)1 SwaggerResource (gov.ca.cwds.rest.resources.SwaggerResource)1 TokenResource (gov.ca.cwds.rest.resources.TokenResource)1 AssetsBundle (io.dropwizard.assets.AssetsBundle)1 DefaultJaxrsScanner (io.swagger.jaxrs.config.DefaultJaxrsScanner)1 DeploymentInfo (io.undertow.servlet.api.DeploymentInfo)1 ServletInfo (io.undertow.servlet.api.ServletInfo)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 URL (java.net.URL)1 URLClassLoader (java.net.URLClassLoader)1 ArrayList (java.util.ArrayList)1