@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); }
PathAdjuster adjuster = new PathMappingAdjuster(documentationContext); ApiListingBuilder apiListingBuilder = new ApiListingBuilder(context.apiDescriptionOrdering()) .apiVersion(documentationContext.getApiInfo().getVersion()) .basePath(adjuster.adjustedPath(basePath)) .resourcePath(resourcePath)
public Documentation scan(DocumentationContext context) { ApiListingReferenceScanResult result = apiListingReferenceScanner.scan(context); ApiListingScanningContext listingContext = new ApiListingScanningContext(context, result.getResourceGroupRequestMappings()); Multimap<String, ApiListing> apiListings = apiListingScanner.scan(listingContext); Set<Tag> tags = toTags(apiListings); tags.addAll(context.getTags()); DocumentationBuilder group = new DocumentationBuilder() .name(context.getGroupName()) .apiListingsByResourceGroupName(apiListings) .produces(context.getProduces()) .consumes(context.getConsumes()) .host(context.getHost()) .schemes(context.getProtocols()) .basePath(context.getPathProvider().getApplicationBasePath()) .extensions(context.getVendorExtentions()) .tags(tags); Set<ApiListingReference> apiReferenceSet = newTreeSet(listingReferencePathComparator()); apiReferenceSet.addAll(apiListingReferences(apiListings, context)); ResourceListing resourceListing = new ResourceListingBuilder() .apiVersion(context.getApiInfo().getVersion()) .apis(from(apiReferenceSet).toSortedList(context.getListingReferenceOrdering())) .securitySchemes(context.getSecuritySchemes()) .info(context.getApiInfo()) .build(); group.resourceListing(resourceListing); return group.build(); }
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>()); } }
/** * 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 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() ); } }
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); } }
@Bean public Docket swaggerSpringMvcPlugin() { ApiInfo apiInfo = new ApiInfo( "Spring Boot APIs", "Spring Boot + Swagger2", "1.0.0", null, "王磊的博客", "作者:王磊", "http://www.apigo.cn/"); Docket docket = new Docket(DocumentationType.SWAGGER_2) .select() .paths(regex("/api/.*")) .build() .apiInfo(apiInfo) .useDefaultResponseMessages(false); return docket; } }
@Bean public Docket dictionaryApi() { ApiInfo apiInfo = new ApiInfo("Dictionary Api Documentation", "Documentation of the rest endpoint for the dictionary application", "v1", "", // termsOfServiceUrl "", // contact "", // license ""); // licenseUrl return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo) .select() .apis(Predicates.or(RequestHandlerSelectors.basePackage("org.oruko.dictionary.web.rest"), RequestHandlerSelectors.basePackage("org.oruko.dictionary.auth.rest"))) .build(); }