zoukankan      html  css  js  c++  java
  • Spring Boot 入门(七)生成接口契约

    我这里使用的是smart-doc

    官网地址:https://smart-doc-group.github.io/#/zh-cn/?id=smart-doc

    • 在项目中创建/src/main/resources/smart-doc.json
    {
      "outPath": "./src/main/resources/static/contract",
      "allInOne": true,  //是否将文档合并到一个文件中,一般推荐为true
      "createDebugPage": true //@since 2.0.0 smart-doc支持创建可以测试的html页面,仅在AllInOne模式中起作用。
    }

    •  把smart-doc插件相关配置放到启动模块的pom中
    <plugin>
        <groupId>com.github.shalousun</groupId>
        <artifactId>smart-doc-maven-plugin</artifactId>
        <version>2.2.7</version>
        <configuration>
            <!--指定生成文档的使用的配置文件,配置文件放在自己的项目中-->
            <configFile>./src/main/resources/smart-doc.json</configFile>
            <!--指定项目名称-->
            <projectName>测试</projectName>
        </configuration>
        <executions>
            <execution>
                <goals>
                    <!--smart-doc提供了html、openapi、markdown等goal,可按需配置-->
                    <goal>html</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
    • 运行“smart-doc:html”,生成文件

    •  预览契约文件

    地址:http://localhost:8080/contract/debug-all.html#_HelloWorld

  • 相关阅读:
    【POJ 1958】 Strange Towers of Hanoi
    【HNOI 2003】 激光炸弹
    【POJ 3263】 Tallest Cow
    【POJ 2689】 Prime Distance
    【POJ 2777】 Count Color
    【POJ 1995】 Raising Modulo Numbers
    【POJ 1845】 Sumdiv
    6月16日省中集训题解
    【TJOI 2018】数学计算
    【POJ 1275】 Cashier Employment
  • 原文地址:https://www.cnblogs.com/xiaoxiaoyu0707/p/15633942.html
Copyright © 2011-2022 走看看