Ejemplo n.º 1
0
 @Bean
 public Docket petApi() {
   return new Docket(DocumentationType.SWAGGER_2)
       .select()
       .apis(RequestHandlerSelectors.any())
       .paths(PathSelectors.any())
       .build()
       .pathMapping("/")
       .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()));
 }
 @Bean
 public Docket mcDoApi() {
   return new Docket(DocumentationType.SWAGGER_2)
       .select()
       .apis(RequestHandlerSelectors.any())
       .paths(PathSelectors.any())
       .build()
       .pathMapping("/")
       .directModelSubstitute(LocalDate.class, String.class)
       .genericModelSubstitutes(ResponseEntity.class)
       .useDefaultResponseMessages(false)
       .enableUrlTemplating(true);
 }
Ejemplo n.º 3
0
 /**
  * apiDoc.
  *
  * @return a {@link springfox.documentation.spring.web.plugins.Docket} object.
  */
 @Bean
 public Docket apiDoc() {
   return new Docket(DocumentationType.SWAGGER_2)
       .apiInfo(apiInfo())
       .groupName("identity-ui")
       .select()
       .apis(RequestHandlerSelectors.any())
       .paths(PathSelectors.ant("/api/**"))
       .build()
       .pathMapping("/")
       .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(true)
       //                .globalResponseMessage(RequestMethod.GET,
       //                        newArrayList(new ResponseMessageBuilder()
       //                                .code(500)
       //                                .message("500 message")
       //                                .responseModel(new ModelRef("Error"))
       //                                .build()))
       //                .securitySchemes(newArrayList(apiKey()))
       //                .securityContexts(newArrayList(securityContext()))
       //                .enableUrlTemplating(true)
       .globalOperationParameters(
           newArrayList(
               new ParameterBuilder()
                   .name("X-XSRF-TOKEN")
                   .description("CRRF token relay")
                   .modelRef(new ModelRef("string"))
                   .parameterType("header")
                   .required(false)
                   .build()))
   //                .tags(new Tag("Pet Service", "All apis relating to pets"))
   //                .additionalModels(typeResolver.resolve(AdditionalModel.class))
   ;
 }