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

  • 相关阅读:
    PS
    div 解决高度塌陷
    gradle Error:Cause: unable to find valid certification path to requested target
    HTML
    前端路线图
    css 选择器
    css-day01
    Python图像处理 | 把图像中的白色变成透明
    X-Frame-Options(点击劫持)
    python两张图片显示在一张图上
  • 原文地址:https://www.cnblogs.com/xiaoxiaoyu0707/p/15633942.html
Copyright © 2011-2022 走看看