@Bean public Docket createRestApi() { ParameterBuilder tokenPar = new ParameterBuilder(); List<Parameter> parameters = new ArrayList<>(); tokenPar.name("xmall-Token") .description("token") .defaultValue("admin") .modelRef(new ModelRef("string")) .parameterType("header") .required(false) .build(); parameters.add(tokenPar.build()); Docket docket = new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .useDefaultResponseMessages(false) .globalOperationParameters(parameters) .select() .apis(RequestHandlerSelectors.basePackage("com.jeiker.mall.controller")) .paths(PathSelectors.any()) .build(); return docket; }
private Predicate<String> paths(Swagger2Properties swagger2Properties) { List<Predicate<String>> basePaths = new ArrayList<>(); if (swagger2Properties.getBasePath().isEmpty()) { basePaths.add(PathSelectors.any()); } for (String basePath : swagger2Properties.getBasePath()) { basePaths.add(PathSelectors.ant(basePath)); } List<Predicate<String>> excludePaths = new ArrayList<>(); for (String excludePath : swagger2Properties.getExcludePath()) { excludePaths.add(PathSelectors.ant(excludePath)); } return Predicates.and( Predicates.not( Predicates.or(excludePaths) ), Predicates.or(basePaths) ); }
public Docket api() { return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build() .pathMapping("/") .directModelSubstitute(LocalDate.class, String.class) .genericModelSubstitutes(ResponseEntity.class) .alternateTypeRules(AlternateTypeRules.newRule(typeResolver.resolve( DeferredResult.class, typeResolver.resolve(ResponseEntity.class, WildcardType.class)), typeResolver.resolve( WildcardType.class))) .useDefaultResponseMessages(false); }
@Bean public Docket practiceApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.sdcuike.practice")) .paths(PathSelectors.any()) .build() .pathMapping("/") .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())) .enableUrlTemplating(true) .tags(new Tag("Pet Service", "All apis relating to pets")); }
@Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .useDefaultResponseMessages(false) .additionalModels(typeResolver.resolve(ErrorInfo.class)) .globalResponseMessage(RequestMethod.GET, getDefaultResponseMessage()) .globalResponseMessage(RequestMethod.POST, getDefaultResponseMessage()) .globalResponseMessage(RequestMethod.PUT, getDefaultResponseMessage()) .globalResponseMessage(RequestMethod.DELETE, getDefaultResponseMessage()) .directModelSubstitute(Timestamp.class, Date.class) .tags(new Tag("默认标签", "定义全局默认标签"),getTags()) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.plumdo.form")) .paths(PathSelectors.any()) .build(); }
@Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .useDefaultResponseMessages(false) .globalResponseMessage(RequestMethod.GET, getDefaultResponseMessage()) .globalResponseMessage(RequestMethod.POST, getDefaultResponseMessage()) .globalResponseMessage(RequestMethod.PUT, getDefaultResponseMessage()) .globalResponseMessage(RequestMethod.DELETE, getDefaultResponseMessage()) .directModelSubstitute(Timestamp.class, Date.class) .tags(new Tag("默认标签", "定义全局默认标签"),getTags()) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.plumdo.form")) .paths(PathSelectors.any()) .build(); }
@Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .useDefaultResponseMessages(false) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.any()) .paths(Predicates.not(PathSelectors.regex("/error.*"))) .build(); }
@Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() // .apis(RequestHandlerSelectors.any()) // show all service, including spring-boot default. .apis(RequestHandlerSelectors.basePackage("com.mkdika.spring5restapi.web.api")) // show specific class path only .paths(PathSelectors.any()) .build() .apiInfo(metaInfo()); }
@Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("tk.ainiyue.danyuan")) .paths(PathSelectors.any()) .build(); }
@Bean public Docket apiDocket() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("org.java10.plum.controllers")) .paths(PathSelectors.any()) .build(); }
@Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.basePackage("com.bbva.arq.devops.ae.mirrorgate.api")) .paths(PathSelectors.any()) .build(); }
@Bean public Docket createRestApi() { Docket docket = new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.jeiker.demo.controller")) .paths(PathSelectors.any()) .build(); return docket; }
@Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage(basePackage)) .paths(PathSelectors.any()) .build(); }
@Bean public Docket api() { String host = environment.getRequiredProperty("application.apiBaseFullPath"); if (host.contains("://")) { host = host.substring(host.indexOf("://") + 3, host.length()); } return new Docket(DocumentationType.SWAGGER_2) .host(host) .pathProvider(new CustomPathProvider()) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build(); }
/** * Create rest api docket. * * @return the docket */ @Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) //.groupName("用户管理") .forCodeGeneration(true) .select() .apis(RequestHandlerSelectors.basePackage("com.lovecws.mumu.swagger")) .paths(PathSelectors.any()) .build(); }
@Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("vip.fanrong")) .paths(PathSelectors.any()) .build(); }
@Bean public Docket internal() { return new Docket(DocumentationType.SWAGGER_2) .groupName("internal") .select() .apis(withClassAnnotation(RestController.class)) .paths(PathSelectors.regex("/internal/.+")) .build() .apiInfo(apiInfo()); }
@Bean public Docket models() { return new Docket(DocumentationType.SWAGGER_2) .groupName("models") .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.regex("/model-.+")) .build() .apiInfo(apiInfo()); }
@Bean public Docket all() { return new Docket(DocumentationType.SWAGGER_2) .groupName("all") .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build() .apiInfo(apiInfo()); }
@Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.eastrobot.web")) .paths(PathSelectors.any()) .build(); }
@Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build(); // /swagger-ui.html }
@Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .useDefaultResponseMessages(false) .select() .apis(RequestHandlerSelectors.basePackage(Application.class.getPackage().getName() + ".controllers")) .paths(PathSelectors.any()) .build(); }
/** * Api docket. * * @return the docket */ @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) .paths(PathSelectors.any()) .build() .apiInfo(aipInfo()); }
@Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.asofdate.hauth.controller")) .paths(PathSelectors.any()) .build(); }
/** * Creates for the dynamic documentation necessary REST API Docket. * @param typeResolver The type resolver. Must not be <code>null</code>. * @return The requested REST API Docket. */ public static Docket createIndoorRestApiDocket(TypeResolver typeResolver) { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(Predicates.not(PathSelectors.regex(EXCLUDE_ERROR_PATH_REGEX))) .build() .pathMapping(ROOT_PATH) .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) .enableUrlTemplating(false) .tags(new Tag(TAG_NAME, TAG_DESCRIPTION)).apiInfo(apiInfo()); }
@Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.quark.rest.controller")) .paths(PathSelectors.any()) .build(); }
@Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build(); }
@Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("cn.mailu.lushx")) .paths(PathSelectors.any()) .build(); }
@Bean public Docket createRestApi() { // return new Docket(DocumentationType.SWAGGER_2) // .apiInfo(apiInfo()) return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("org.zt.ccty.springboot_mybatis_demo.controller")) .paths(PathSelectors.any()) .build(); }
@Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.digag.web")) .paths(PathSelectors.any()) .build(); }
@Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select() .apis(RequestHandlerSelectors.basePackage("com.vsct.supervision")).paths(PathSelectors.any()).build() .useDefaultResponseMessages(false).globalResponseMessage(RequestMethod.GET, responseMessageList()) .globalResponseMessage(RequestMethod.DELETE, responseMessageList()) .globalResponseMessage(RequestMethod.POST, responseMessageList()) .globalResponseMessage(RequestMethod.PUT, responseMessageList()); }
/** * Swagger configuration. * * @return {@link Docket} instance */ @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .enableUrlTemplating(true) .select() .apis(RequestHandlerSelectors.any()) .paths(Predicates.not(PathSelectors.regex("/error.*"))) .build(); }