swagger2 导出api为html和word文档

2021-01-05 09:28

阅读:896

标签:div   handle   ase   include   put   als   can   oct   net   

参考地址

https://blog.csdn.net/zhuyu19911016520/article/details/85048271

依赖引入

dependency>
            groupId>io.springfoxgroupId>
            artifactId>springfox-swagger2artifactId>
            version>2.8.0version>
        dependency>
        dependency>
            groupId>io.springfoxgroupId>
            artifactId>springfox-swagger-uiartifactId>
            version>2.8.0version>
        dependency>

        
        dependency>
            groupId>io.github.swagger2markupgroupId>
            artifactId>swagger2markupartifactId>
            version>1.3.1version>
        dependency>

第二部分需要添加的是生成ASCIIDOC所需要maven插件:


            plugin>
                groupId>io.github.swagger2markupgroupId>
                artifactId>swagger2markup-maven-pluginartifactId>
                version>1.2.0version>
                configuration>
                    
                    swaggerInput>http://localhost:8082/v2/api-docsswaggerInput>
                    outputDir>src/docs/asciidoc/generatedoutputDir>
                    config>
                        
                        swagger2markup.markupLanguage>ASCIIDOCswagger2markup.markupLanguage>
                    config>
                configuration>
            plugin>

第三部分需要添加输出PDF和HTML的maven插件:


            plugin>
                groupId>org.asciidoctorgroupId>
                artifactId>asciidoctor-maven-pluginartifactId>
                version>1.5.3version>
                
                dependencies>
                    dependency>
                        groupId>org.asciidoctorgroupId>
                        artifactId>asciidoctorj-pdfartifactId>
                        version>1.5.0-alpha.10.1version>
                    dependency>
                    dependency>
                        groupId>org.jrubygroupId>
                        artifactId>jruby-completeartifactId>
                        version>1.7.21version>
                    dependency>
                dependencies>
                
                configuration>
                    sourceDirectory>src/docs/asciidoc/generatedsourceDirectory>
                    sourceHighlighter>coderaysourceHighlighter>
                    attributes>
                        toc>lefttoc>
                    attributes>
                configuration>
                
                executions>
                    execution>
                        id>output-htmlid>
                        phase>generate-resourcesphase>
                        goals>
                            goal>process-asciidocgoal>
                        goals>
                        configuration>
                            backend>html5backend>
                            outputDirectory>src/docs/asciidoc/htmloutputDirectory>
                        configuration>
                    execution>

                    execution>
                        id>output-pdfid>
                        phase>generate-resourcesphase>
                        goals>
                            goal>process-asciidocgoal>
                        goals>
                        configuration>
                            backend>pdfbackend>
                            outputDirectory>src/docs/asciidoc/pdfoutputDirectory>
                        configuration>
                    execution>

                executions>
            plugin>

最后执行命令

1.mvn swagger2markup:convertSwagger2markup

2.mvn generate-resources

swagger2 导出api为html和word文档

标签:div   handle   ase   include   put   als   can   oct   net   

原文地址:https://www.cnblogs.com/james-roger/p/13183661.html


评论


亲,登录后才可以留言!