如何在管道上生成API变化的报告?
我已经使用 Swagger-diff
我可以使用makefile或脚本在本地计算机中自动化它,但是如果我想在gitlab管道中实现它,当有人在API端点上推动更改时,我该如何生成报告
java -jar bin/swagger-diff.jar -old https://url/v1/swagger.json -new https://url2/v2/swagger.json -v 2.0 -output-mode html > changes.html
请注意:所有项目代码也都被容器化。
I have manually generated the report of my API changes using swagger-diff
I can automate it in a local machine using makefile or script but what about if I wanted to implement it in the Gitlab pipeline, how can I generate the report in such a way when someone pushes the changes on the API endpoints
java -jar bin/swagger-diff.jar -old https://url/v1/swagger.json -new https://url2/v2/swagger.json -v 2.0 -output-mode html > changes.html
Note that: All the project code is also being containerized.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在API路由发生更改时,在管道中配置作业以运行。将输出作为工件保存。如果您还需要发布的差异,则可以在该作业中进行发布,也可以创建依赖的作业,该作业使用工件将差异发布到GitLab页面或外部提供商。
如果您已经在本地自动化了该过程,则大多数工作已经在外壳脚本或类似内容中完成。
例子:
此示例假设您的API路由是在
customer/api/autes/
和内部/api/code
中定义的推到开发分支。然后,如果您想要的话,要发布差异的工作。这也可以在生成差异的同一工作中完成。
Configure a job in the pipeline to run when there are changes to your api routes. Save the output as an artifact. If you also need the diff published, you could either do the publishing in that job or create a dependent job which uses the artifact to publish the diff to a Gitlab page or external provider.
If you have automated the process locally, then most of the work is done already if it is in a shell script or something similar.
Example:
This example assumes that your api routes are defined in
customer/api/routes/
andinternal/api/routes
and that you want to generate the diff when a commit or MR is pushed to the dev branch.And then the job to publish the diff if you want one. This could also be done in the same job that generates the diff.