@Bean public Docket configure(SwaggerApiInfo info, TypeResolver typeResolver) { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.basePackage("com.github.prontera")) .paths(PathSelectors.any()) .build() .pathMapping("/") .useDefaultResponseMessages(false) .globalResponseMessage(RequestMethod.OPTIONS, info.getStatusList()) .apiInfo(new ApiInfo(info.getTitle(), DESCRIPTION, info.getVersion(), info.getServiceUrl(), new Contact(null, null, null), null, null)) .alternateTypeRules( AlternateTypeRules.newRule( typeResolver.resolve(PageInfo.class, WildcardType.class), typeResolver.resolve(SwaggerPaginationResponse.class, WildcardType.class)), AlternateTypeRules.newRule( typeResolver.resolve(Collection.class, WildcardType.class), typeResolver.resolve(List.class, WildcardType.class)) ) //.enableUrlTemplating(true) .forCodeGeneration(false); }
private ApiInfo apiInfo() { return new ApiInfo( title, description, null, null, contact, null, null ); }
@SuppressWarnings("deprecation") private ApiInfo apiInfo() { return new ApiInfo("Vorto","", "", "", "Eclipse Vorto Team", "EPL", "https://www.eclipse.org/legal/epl-2.0"); }
private ApiInfo apiInfo() { ApiInfo apiInfo = new ApiInfo("ALIEN 4 Cloud API", "Welcome on the live configuration of ALIEN 4 Cloud Rest API.", CURRENT_API_VERSION, "", "Need help? Join us on slack! https://alien4cloud.github.io/community/index.html", "Licensed under the Apache License, Version 2.0", "http://www.apache.org/licenses/LICENSE-2.0"); return apiInfo; }
private ApiInfo getApiInfo() { ApiInfo apiInfo = new ApiInfo("Iveely Search Engine API", "Iveely is an open source search engine, including crawler, " + "distributed computing framework and so on.", "0.9.1", "http://github.com/fanping/iveely.search", "liufanping@iveely.com", "The Apache License, Version 2.0", "http://www.apache.org/licenses/LICENSE-2.0.html" ); return apiInfo; } }
@Bean ApiInfo apiInfo() { return new ApiInfo( "Fullstop API", "Audit reporting", "", "", ApiInfo.DEFAULT_CONTACT, "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0.html", emptyList()); }
ApiInfo apiInfo(String apiName) { return new ApiInfo( projectName + " " + apiName + " API", projectDescription, projectVersion, projectTermsUrl, null, projectLicenseName, projectLicenseUrl, new ArrayList<VendorExtension>() ); } }
@Bean public ApiInfo apiInfo() { return new ApiInfo( "Widerest", "RESTful API for Broadleaf Commerce - an open source eCommerce platform based on the Spring Framework", String.valueOf(getClass().getPackage().getImplementationVersion()), "Widerest terms of service", "info@touk.pl", "Widerest Licence", "license.html" ); }
@Configuration @EnableSwagger2 public class AppConfig { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()).paths(PathSelectors.regex("/app/.*")).build().apiInfo(apiInfo()); } private ApiInfo apiInfo() { ApiInfo apiInfo = new ApiInfo("Rest API","API(s) for mobile developers","","","","", ""); return apiInfo; } }
@Bean public ApiInfo apiInfo(@Value("${rest.api.title:Microservice API}") String title, @Value("${rest.api.description:APIs for this microservice}") String description, @Value("${rest.api.version:1.0}") String apiVersion, @Value("${rest.api.terms:Defined by 4finance internal licences}") String terms, @Value("${rest.api.contact:info@4finance.com}") String contactEmail, @Value("${rest.api.license.type:4finance internal licence}") String licenseType, @Value("${rest.api.license.url:http://4finance.com}") String licenseUrl) { return new ApiInfo(title, description, apiVersion, terms, new Contact(null, null, contactEmail), licenseType, licenseUrl, new ArrayList<>()); }
@Bean public Docket swaggerSpringMvcPlugin() { ApiInfo apiInfo = new ApiInfo("", "", null, null, null, null, null); Docket docket = new Docket(DocumentationType.SWAGGER_2).select().paths(regex("^(?!.*error).*$")).build() .apiInfo(apiInfo).useDefaultResponseMessages(false); return docket; } }
private ApiInfo apiInfo() { return new ApiInfo("ICOnator", "An easy, secure, configurable, and scalable open source ICO engine -- driven by the community", null, null, new Contact("ICOnator Project", "https://iconator.io", "info@iconator.io"), "Apache 2", "", new ArrayList<VendorExtension>()); } }
private ApiInfo testApiInfo() { return new ApiInfo("APP-ENGINE接口文档", "文档说明", "0.1", "NO terms of service", new Contact("sofn", "https://github.com/sofn", "lesofn@gmail.com"), "The Apache License, Version 2.0", "https://www.apache.org/licenses/LICENSE-2.0.html", Collections.emptyList() ); } }
/** * Initialization of documentation * * @return static infos */ private ApiInfo apiInfo() { return new ApiInfo( "ff4j (ff4j.org) Feature Toggle for Java Platform", "Operation FF4J solution through API (features, properties, audit)", FF4j.class.getPackage().getImplementationVersion(), "Terms of service", new Contact("Paul William", "", "paul589140480@gmail.com"), "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0.html", Lists.newArrayList()); } }
private ApiInfo apiInfo() { return new ApiInfo( "Controller Blueprints API", "Controller blueprints API for VNF Self Service.", appVersion, "Terms of service", new Contact(contactName, contactUrl, contactEmail), "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", Collections.emptyList()); }
@SpringBootApplication @ComponentScan(basePackages = { "test" }) @EnableSwagger2 public class Application { @Bean public Docket confApi() { ResponseMessage msg_500 = new ResponseMessageBuilder().code(500).message("500 message").responseModel(new ModelRef("Error")).build(); return new Docket(DocumentationType.SWAGGER_2).globalResponseMessage(RequestMethod.GET, Collections.singletonList(msg_500)) .globalResponseMessage(RequestMethod.POST, Collections.singletonList(msg_500)) .apiInfo(new ApiInfo("My Api Documentation", "My Api Documentation, Version: 1.0", "1.0", null, "my_name@gmail.com", null, null)); } public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
private ApiInfo apiInfo() { return new ApiInfo( "Castle Mock REST API", "", this.version, null, new Contact("Castle Mock", "https://www.castlemock.com", "contact@castlemock.com"), "Apache License 2.0", "https://github.com/castlemock/castlemock/blob/master/LICENSE", Collections.emptyList()); } }
@Bean public Docket docket() { ApiSelectorBuilder apiSelectorBuilder = new Docket(DocumentationType.SWAGGER_2).select(); apiSelectorBuilder.apis(withClassAnnotation(Api.class)); return apiSelectorBuilder .build() .pathMapping("/") .useDefaultResponseMessages(false) .apiInfo(new ApiInfo("Service A API Doc", "Service A API Doc", "1.0", "https://github.com/yidongnan/spring-cloud-consul-example", new Contact("Michael", "https://github.com/yidongnan", "yidongnan@gmail.com"), null, null)) .forCodeGeneration(true); }
@Bean public Docket docket() { ApiSelectorBuilder apiSelectorBuilder = new Docket(DocumentationType.SWAGGER_2).select(); apiSelectorBuilder.apis(withClassAnnotation(Api.class)); return apiSelectorBuilder .build() .pathMapping("/") .useDefaultResponseMessages(false) .apiInfo(new ApiInfo("Service B API Doc", "Service B API Doc", "1.0", "https://github.com/yidongnan/spring-cloud-consul-example", new Contact("Michael", "https://github.com/yidongnan", "yidongnan@gmail.com"), null, null)) .forCodeGeneration(true); }
@Bean public Docket backendApi() { return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()).paths(PathSelectors.any()).build().pathMapping("/") .apiInfo(new springfox.documentation.service.ApiInfo("Vulas CIA", "RESTful API for discovering and analyzing alternative Maven artifacts", "1.1.0-SNAPSHOT", "SAP", null, "commercial", null)) .directModelSubstitute(LocalDate.class, String.class).genericModelSubstitutes(ResponseEntity.class) .alternateTypeRules(newRule(typeResolver.resolve(DeferredResult.class, typeResolver.resolve(ResponseEntity.class, WildcardType.class)), typeResolver.resolve(WildcardType.class))) .useDefaultResponseMessages(false) .globalResponseMessage(RequestMethod.GET, newArrayList(new ResponseMessageBuilder().code(500).message("500 message").responseModel(new ModelRef("Error")).build())); //.securitySchemes(newArrayList(apiKey())).securityContexts(newArrayList(securityContext())); }