springfox.documentation.service.ApiInfo Java Examples

The following examples show how to use springfox.documentation.service.ApiInfo. 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: SwaggerConfiguration.java    From api-layer with Eclipse Public License 2.0 7 votes vote down vote up
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
        .select()
        .apis(RequestHandlerSelectors.basePackage("org.zowe.apiml.apicatalog.controllers.api"))
        .paths(
            PathSelectors.any()
        )
        .build()
        .securitySchemes(
            Arrays.asList(
                new BasicAuth("LoginBasicAuth"),
                new ApiKey("CookieAuth", "apimlAuthenticationToken", "header")
            )
        )
        .apiInfo(
            new ApiInfo(
                apiTitle,
                apiDescription,
                apiVersion,
                null,
                null,
                null,
                null,
                Collections.emptyList()
            )
        );
}
 
Example #2
Source File: ProductCompositeServiceApplication.java    From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License 6 votes vote down vote up
/**
 * Will exposed on $HOST:$PORT/swagger-ui.html
 *
 * @return
 */
@Bean
public Docket apiDocumentation() {

	return new Docket(SWAGGER_2)
		.select()
		.apis(basePackage("se.magnus.microservices.composite.product"))
		.paths(PathSelectors.any())
		.build()
			.globalResponseMessage(POST, emptyList())
			.globalResponseMessage(GET, emptyList())
			.globalResponseMessage(DELETE, emptyList())
			.apiInfo(new ApiInfo(
                   apiTitle,
                   apiDescription,
                   apiVersion,
                   apiTermsOfServiceUrl,
                   new Contact(apiContactName, apiContactUrl, apiContactEmail),
                   apiLicense,
                   apiLicenseUrl,
                   emptyList()
               ));
   }
 
Example #3
Source File: SwaggerConfiguration.java    From api-layer with Eclipse Public License 2.0 6 votes vote down vote up
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
        .select()
        .apis(RequestHandlerSelectors.any())
        .paths(PathSelectors.ant("/api/v1/**"))
        .build()
        .apiInfo(
            new ApiInfo(
                apiTitle,
                apiDescription,
                apiVersion,
                null,
                null,
                null,
                null,
                Collections.emptyList()
            )
        );
}
 
Example #4
Source File: SwaggerConfiguration.java    From api-layer with Eclipse Public License 2.0 6 votes vote down vote up
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
        .select()
        .apis(RequestHandlerSelectors.any())
        .paths(PathSelectors.ant("/api/v1/**"))
        .build()
        .apiInfo(
            new ApiInfo(
                apiTitle,
                apiDescription,
                apiVersion,
                null,
                null,
                null,
                null,
                Collections.emptyList()
            )
        );
}
 
Example #5
Source File: SwaggerConfig.java    From SpringCloud with Apache License 2.0 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("系统管理API")
            .description("系统管理,组织人员管理、角色权限管理、岗位管理")
            .termsOfServiceUrl("https://github.com/zhoutaoo/SpringCloud")
            .version("2.0")
            .build();
}
 
Example #6
Source File: Swagger2Config.java    From hdw-dubbo with Apache License 2.0 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            // 文档标题
            .title(swagger2Properties.getTitle())
            // 文档描述
            .description(swagger2Properties.getDescription())
            .version(swagger2Properties.getVersion())
            .license("MIT 协议")
            .licenseUrl("http://www.opensource.org/licenses/MIT")
            .build();
}
 
Example #7
Source File: SwaggerConfig.java    From summerframework with Apache License 2.0 5 votes vote down vote up
@Bean
public Docket docket() {
    ArrayList<String> basePackage=new ArrayList<>();
    if(!StringUtils.isEmpty(swaggerBasePackage)){
        basePackage.addAll(Arrays.asList(swaggerBasePackage.split(",")));
    }else {
        // 从注解中解析basePackage
        Map<String, Object> applicationClass = applicationContext.getBeansWithAnnotation(SpringBootApplication.class);
        if(applicationClass.size()>1){
            log.warn("{} SpringBootApplication : {}",applicationClass.size(),applicationClass);
        }
        applicationClass.forEach((k,v)->{
            SpringBootApplication ann = AnnotationUtils.findAnnotation(v.getClass(), SpringBootApplication.class);
            if(ann.scanBasePackages().length==0&&ann.scanBasePackageClasses().length==0){
                basePackage.add(v.getClass().getPackage().getName());
            }else {
                basePackage.addAll(Arrays.asList(ann.scanBasePackages()));
                basePackage.addAll(Arrays.asList(ann.scanBasePackageClasses()).stream().map(s->s.getPackage().getName()).collect(Collectors.toList()));
            }
        });
    }
    return new Docket(DocumentationType.SWAGGER_2).select().apis(Predicates.or(basePackage.stream().map(RequestHandlerSelectors::basePackage).collect(Collectors.toList())))
        .paths(Predicates.not(PathSelectors.regex("/error.*"))).build()
        .apiInfo(new ApiInfo(configurableEnvironment.getProperty("spring.application.name"), "",
            configurableEnvironment.getProperty("spring.application.version"), "",
            new Contact(configurableEnvironment.getProperty("spring.application.contact"), "", ""), "", "",
            new ArrayList<>()));
}
 
Example #8
Source File: SwaggerConfig.java    From SpringCloud with Apache License 2.0 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("网关管理api")
            .description("网关管理")
            .termsOfServiceUrl("https://github.com/zhoutaoo/SpringCloud")
            .version("2.0")
            .build();
}
 
Example #9
Source File: Swagger2.java    From Resource with GNU General Public License v3.0 5 votes vote down vote up
private ApiInfo apiInfo()
{
    return new ApiInfoBuilder()
        //页面标题
        .title("Spring Boot 测试 Swagger2 构建RESTful API文档")
        //创建人
        .contact(new Contact("zengsm", "", ""))
        //版本号
        .version("1.0.0")
        //描述
        .description("API文档描述")
        .build();
}
 
Example #10
Source File: Swagger2Config.java    From SpringBootBucket with MIT License 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            // 文档标题
            .title("系统API服务")
            // 文档描述
            .description("系统API接口文档")
            // .termsOfServiceUrl("https://github.com/yidao620c")
            .version("v1")
            // .license("MIT 协议")
            // .licenseUrl("http://www.opensource.org/licenses/MIT")
            // .contact(new Contact("熊能","https://github.com/yidao620c","[email protected]"))
            .build();
}
 
Example #11
Source File: TxManagerConfiguration.java    From Lottor with MIT License 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("Lottor Server")
            .description("Lottor UI接口描述")
            .termsOfServiceUrl("http://blueskykong.com")
            .version("1.0")
            .build();
}
 
Example #12
Source File: SwaggerConfig.java    From spring-microservice-boilerplate with MIT License 5 votes vote down vote up
private ApiInfo appApiInfo() {
  return new ApiInfoBuilder()
      .title(TITLE)
      .description(DESCRIPTION_APP)
      .termsOfServiceUrl(TERMS)
      .contact(new Contact(NAME, URL, EMAIL))
      .license(LICENSE)
      .licenseUrl(LICENSE_URL)
      .version(VERSION)
      .build();
}
 
Example #13
Source File: Swagger2Config.java    From mall-learning with Apache License 2.0 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("SwaggerUI演示")
            .description("mall-tiny")
            .contact("macro")
            .version("1.0")
            .build();
}
 
Example #14
Source File: Swagger2AutoConfigure.java    From fast-family-master with Apache License 2.0 5 votes vote down vote up
@Bean
public Docket createRestApi(Swagger2RestApiProperties swagger2RestApiProperties, ApiInfo apiInfo) {

    return new Docket(DocumentationType.SWAGGER_2)
            .apiInfo(apiInfo)
            .select()
            .apis(Optional.ofNullable(swagger2RestApiProperties.getBackPackage())
                    .map(RequestHandlerSelectors::basePackage).orElse(RequestHandlerSelectors.any()))
            .paths(Optional.ofNullable(swagger2RestApiProperties.getPaths()).map(PathSelectors::regex)
                    .orElse(PathSelectors.any()))
            .build();
}
 
Example #15
Source File: SwaggerConfiguration.java    From spring-boot-seed with MIT License 5 votes vote down vote up
private ApiInfo apiInfo() {
    Contact contact = new Contact(
            projectProperties.getAuthor().getName(),
            projectProperties.getAuthor().getUrl(),
            projectProperties.getAuthor().getEmail());
    return new ApiInfoBuilder()
            .title(projectProperties.getName())
            .description(projectProperties.getDescription())
            .version(projectProperties.getVersion())
            .contact(contact)
            .build();
}
 
Example #16
Source File: Swagger2Config.java    From mall-learning with Apache License 2.0 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("SwaggerUI演示")
            .description("mall-tiny")
            .contact("macro")
            .version("1.0")
            .build();
}
 
Example #17
Source File: SwaggerConfig.java    From alcor with Apache License 2.0 5 votes vote down vote up
private ApiInfo apiInfo(){
    return new ApiInfoBuilder()
            .title("Node Manager")
            .description("Node metadata management")
            .license("Apache 2.0")
            .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
            .build();
}
 
Example #18
Source File: SwaggerConfiguration.java    From cxf-spring-cloud-netflix-docker with MIT License 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("Just a simple REST backend")
            .description("This is a RESTful HttpService written in Spring. Try to use some other HTTP verbs (don´t say 'methods' :P ) :)")
            .version("0.0.25")
            .build(); 
}
 
Example #19
Source File: Swagger2Config.java    From mall-learning with Apache License 2.0 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("SwaggerUI演示")
            .description("mall-tiny")
            .contact("macro")
            .version("1.0")
            .build();
}
 
Example #20
Source File: SwaggerConfig.java    From restful-booker-platform with GNU General Public License v3.0 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("RestfulBooker Report service")
            .description("Report service for Restful Booker. An application for teaching Automation in Testing")
            .contact(new Contact("Mark Winteringham / Richard Bradshaw", "https://automationintesting.com/", "[email protected]"))
            .license("MIT")
            .licenseUrl("https://opensource.org/licenses/MIT")
            .version("1.0")
            .build();
}
 
Example #21
Source File: SwaggerConfiguration.java    From jhipster-ribbon-hystrix with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Swagger Springfox configuration.
 *
 * @param jHipsterProperties the properties of the application
 * @return the Swagger Springfox configuration
 */
@Bean
public Docket swaggerSpringfoxDocket(JHipsterProperties jHipsterProperties) {
    log.debug("Starting Swagger");
    StopWatch watch = new StopWatch();
    watch.start();
    Contact contact = new Contact(
        jHipsterProperties.getSwagger().getContactName(),
        jHipsterProperties.getSwagger().getContactUrl(),
        jHipsterProperties.getSwagger().getContactEmail());

    ApiInfo apiInfo = new ApiInfo(
        jHipsterProperties.getSwagger().getTitle(),
        jHipsterProperties.getSwagger().getDescription(),
        jHipsterProperties.getSwagger().getVersion(),
        jHipsterProperties.getSwagger().getTermsOfServiceUrl(),
        contact,
        jHipsterProperties.getSwagger().getLicense(),
        jHipsterProperties.getSwagger().getLicenseUrl());

    Docket docket = new Docket(DocumentationType.SWAGGER_2)
        .apiInfo(apiInfo)
        .forCodeGeneration(true)
        .genericModelSubstitutes(ResponseEntity.class)
        .ignoredParameterTypes(Pageable.class)
        .ignoredParameterTypes(java.sql.Date.class)
        .directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class)
        .directModelSubstitute(java.time.ZonedDateTime.class, Date.class)
        .directModelSubstitute(java.time.LocalDateTime.class, Date.class)
        .select()
        .paths(regex(DEFAULT_INCLUDE_PATTERN))
        .build();
    watch.stop();
    log.debug("Started Swagger in {} ms", watch.getTotalTimeMillis());
    return docket;
}
 
Example #22
Source File: SwaggerConfig.java    From docs-manage with MIT License 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder().title("认证授权API")
            .description("")
            .termsOfServiceUrl("https://www.apache.org/licenses/LICENSE-2.0.html")
            .contact(new Contact("汤胜", "","[email protected]"))
            .version("v1.2.0")
            .build();
}
 
Example #23
Source File: SwaggerConfig.java    From withme3.0 with MIT License 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("WithMe User Service")
            .description("provide api of user")
            .termsOfServiceUrl("")
            .version("1.0")
            .build();
}
 
Example #24
Source File: Swagger2Config.java    From springboot_cwenao with MIT License 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("Spring Boot Swagger2 test Restful API")
            .description("更多内容请详见代码")
            .termsOfServiceUrl("http://blog.csdn.net/cwenao")
            .contact("cwenao")
            .version("0.5.0")
            .build();
}
 
Example #25
Source File: Swagger2AutoConfigure.java    From fast-family-master with Apache License 2.0 5 votes vote down vote up
@Bean(name = "swagger2ApiInfo")
public ApiInfo apiInfo(Swagger2ApiInfoProperties apiInfoProperties) {
    return new ApiInfoBuilder()
            .title(apiInfoProperties.getTitle())
            .description(apiInfoProperties.getDescription())
            .termsOfServiceUrl(apiInfoProperties.getTermsOfServiceUrl())
            .version(apiInfoProperties.getVersion())
            .contact(new Contact(apiInfoProperties.getContactName(),
                    apiInfoProperties.getContactUrl(), apiInfoProperties.getContactEmail()))
            .license(apiInfoProperties.getLicense())
            .licenseUrl(apiInfoProperties.getLicenseUrl())
            .build();
}
 
Example #26
Source File: SwaggerConfig.java    From yyblog with MIT License 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("yyblog项目api接口文档")
            .description("部分接口展示")
            .contact(new Contact("小卖铺的老爷爷", "http://www.laoyeye.net/", "allan_zhuo#163.com"))
            .version("1.0")
            .build();
}
 
Example #27
Source File: SwaggerConfig.java    From restful-booker-platform with GNU General Public License v3.0 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("RestfulBooker Booking service")
            .description("Booking service for Restful Booker. An application for teaching Automation in Testing")
            .contact(new Contact("Mark Winteringham / Richard Bradshaw", "https://automationintesting.com/", "[email protected]"))
            .license("MIT")
            .licenseUrl("https://opensource.org/licenses/MIT")
            .version("1.0")
            .build();
}
 
Example #28
Source File: Swagger2Config.java    From SpringBootLearn with Apache License 2.0 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            // 文档标题
            .title("springboot利用swagger构建api文档")
            // 文档详细描述
            .description("简单优雅的restfun风格,http://www.lhdyx.cn")
            // 作者
            .contact(new Contact("小东", "http://www.lhdyx.cn", "[email protected]"))
            // 版本号
            .version("1.0")
            .build();
}
 
Example #29
Source File: OpenAPIDocumentationConfig.java    From swagger-aem with Apache License 2.0 5 votes vote down vote up
@Bean
public Docket swaggerSpringfoxDocket(PkmstProperties pkmstProperties) {
    StopWatch watch = new StopWatch();
    watch.start();
    Contact contact = new Contact(
    		pkmstProperties.getSwagger().getContactName(),
    		pkmstProperties.getSwagger().getContactUrl(),
    		pkmstProperties.getSwagger().getContactEmail());

    ApiInfo apiInfo = new ApiInfo(
    		pkmstProperties.getSwagger().getTitle(),
    		pkmstProperties.getSwagger().getDescription(),
    		pkmstProperties.getSwagger().getVersion(),
    		pkmstProperties.getSwagger().getTermsOfServiceUrl(),
        contact,
        pkmstProperties.getSwagger().getLicense(),
        pkmstProperties.getSwagger().getLicenseUrl());

    Docket docket = new Docket(DocumentationType.SWAGGER_2)
        .apiInfo(apiInfo)
        .forCodeGeneration(true)
        .genericModelSubstitutes(ResponseEntity.class)
        .ignoredParameterTypes(java.sql.Date.class)
        .directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class)
        .directModelSubstitute(java.time.ZonedDateTime.class, Date.class)
        .directModelSubstitute(java.time.LocalDateTime.class, Date.class)
        .select()
        .apis(RequestHandlerSelectors.basePackage("com.prokarma.pkmst"))
       // .paths(regex(DEFAULT_INCLUDE_PATTERN))
        .paths(PathSelectors.any())
        .build();
    watch.stop();
    return docket;
}
 
Example #30
Source File: Swagger2Config.java    From macrozheng-mall with MIT License 5 votes vote down vote up
private ApiInfo apiInfo() {
    return new ApiInfoBuilder()
            .title("mall搜索系统")
            .description("mall搜索模块")
            .contact("macro")
            .version("1.0")
            .build();
}