Advertisement
ArturCzopek

swagger-docket-regex2

Apr 23rd, 2017
2,323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Getter
  2. @Setter
  3. @Configuration
  4. @EnableSwagger2
  5. @ConfigurationProperties(prefix = "myCoach.swagger")
  6. public class SwaggerConfiguration {
  7.  
  8.     //...
  9.  
  10.     private static final String NO_ERROR_REGEX = "(?!.*error).*$";
  11.    
  12.     //...
  13.  
  14.     @Bean
  15.     public Docket api() {
  16.         return new Docket(DocumentationType.SWAGGER_2)
  17.                 //...
  18.                 .paths(paths())
  19.                 .build();
  20.     }
  21.  
  22.     //...
  23.  
  24.     private Predicate<String> paths() {
  25.         return and(
  26.                 regex(NO_ERROR_REGEX)
  27.         );
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement