-1

I create a springboot+mybatis+swagger project, I want to use swagger to export the project api, I did write swagger annotation in my code.

How Can I to export api as html or doc or chm?

enter image description here

lakelise
  • 1
  • 3
  • Hi, there are some resources here: https://stackoverflow.com/questions/25800493/converting-swagger-specification-json-to-html-documentation –  Jul 10 '17 at 05:41

1 Answers1

0

To bring Swagger in, we need the following dependency declaration in our Maven POM

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger2</artifactId>
    <version>2.6.1</version>
    <scope>compile</scope>
</dependency>

<dependency>
    <groupId>io.springfox</groupId>
    <artifactId>springfox-swagger-ui</artifactId>
    <version>2.6.1</version>
    <scope>compile</scope>
</dependency>

Configuring Swagger 2 in the Application

@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket productApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()                 .apis(RequestHandlerSelectors.basePackage("com.springframework.example"))
                .paths("/")
                .build();

    }
}

At this point, you should be able to test the configuration by starting the app and pointing your browser to http://localhost:8080/v2/api-docs

On pointing your browser to http://localhost:8080/swagger-ui.html, you will see the generated documentation rendered by Swagger UI.

Reference Document

Darshit Chokshi
  • 589
  • 3
  • 13
  • I can use http://localhost:8080/v2/api-docs to create swagger.json ,but I want to create html doc or pdf format – lakelise Jul 10 '17 at 08:22