5

I have a problem with Swagger configuration.
Right now Swagger is scanning for packages and creating nice documentation, but I would like to use my YAML (or JSON if YAML usage is not possible) file.

This is my Swagger configuration class:

@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.myapp.rest"))
            .paths(PathSelectors.any())
            .build();
    }
}

I would like to write examples of usage in YAML file, so Swagger can display them. How can I change/add configuration for Swagger to pick up my YAML file?

Serafino
  • 13
  • 6
chamber5
  • 195
  • 2
  • 8

1 Answers1

0

You can download and place the swagger UI in your project change the URL to point to the YAML file .

More on here,

How can I modify swagger-ui.html for springfox?

Srinivasan Sekar
  • 2,049
  • 13
  • 22