Java Code Examples for springfox.documentation.spi.DocumentationType#SWAGGER_2

The following examples show how to use springfox.documentation.spi.DocumentationType#SWAGGER_2 . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwaggerConfiguration.java    From haven-platform with Apache License 2.0 5 votes vote down vote up
@Bean
public Docket newsApi() {
    Docket docket = new Docket(DocumentationType.SWAGGER_2);
    return docket
            .groupName("DockMaster")
            .apiInfo(apiInfo())
            //it need for correct samples of date
            .directModelSubstitute(Date.class, Long.class)
            .select()
            .apis(RequestHandlerSelectors.any())
            .paths(makePathRegexp())
            .build();
}
 
Example 2
Source File: SwaggerConfig.java    From metron with Apache License 2.0 5 votes vote down vote up
@Bean
public Docket api() {
  List<String> activeProfiles = Arrays.asList(environment.getActiveProfiles());
  Docket docket = new Docket(DocumentationType.SWAGGER_2);
  if (activeProfiles.contains(KNOX_PROFILE)) {
    String knoxRoot = environment.getProperty(MetronRestConstants.KNOX_ROOT_SPRING_PROPERTY, String.class, "");
    docket = docket.pathProvider(new RelativePathProvider (servletContext) {
      @Override
      protected String applicationPath() {
        return knoxRoot;
      }

      @Override
      protected String getDocumentationPath() {
        return knoxRoot;
      }

      @Override
      public String getApplicationBasePath() {
        return knoxRoot;
      }

      @Override
      public String getOperationPath(String operationPath) {
        return knoxRoot + super.getOperationPath(operationPath);
      }
    });
  }
  return docket.select()
          .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
          .paths(PathSelectors.any())
          .build();
}
 
Example 3
Source File: SwaggerAutoConfiguration.java    From albedo with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected Docket createDocket() {
	return new Docket(DocumentationType.SWAGGER_2);
}
 
Example 4
Source File: SwaggerAutoConfiguration.java    From jhipster with Apache License 2.0 2 votes vote down vote up
/**
 * <p>createDocket.</p>
 *
 * @return a {@link springfox.documentation.spring.web.plugins.Docket} object.
 */
protected Docket createDocket() {
    return new Docket(DocumentationType.SWAGGER_2);
}