设置API版本与UI扬鞭 [英] Setting the Api Version with Swagger UI
问题描述
我通过使用泽西开发的REST API,我们通过记录招摇-UI的REST API。不幸的是,我们并没有开始从版本1天,我们正试图版本添加到API的API。
I have a REST API developed through the use of Jersey and we document the REST API through swagger-ui. Unfortunately, we did not start versioning the API from day 1. We are now trying to add versioning to the API.
第一步我是在为我试图更新由动态生成的招摇(HTML)页面中显示的API版本。我跟踪的呼叫流程一路招摇,ui.js文件,但我无法弄清楚如何在动态生成的页面的底部更改显示的API版本。
The first step I'm taking is I'm trying to update the API version that is displayed by the dynamically generated swagger (html) page. I've traced the call flow all the way to the swagger-ui.js file but I can't figure out how to change the displayed API version at the bottom of the dynamically generated page.
这是目前处于底部显示的默认值是API版本:1.0.0。
The default that is currently displayed at the bottom is ' API VERSION: 1.0.0 '.
我读过一些关于ServiceStack <一个href=\"http://stackoverflow.com/questions/22224308/servicestack-swagger-ui-and-api-version-number\">here但遗憾的是code碱基我的工作没有使用任何的排序。
I've read something about a ServiceStack here but unfortunately the code base I'm working on doesn't use anything of the sort.
任何人都可以请您指出我的地方/我需要以更新显示的API的版本号更改/更新什么?
Could anyone please kindly point me to where/what I would need to change/update in order to update the displayed API version number?
推荐答案
这里描述您可以添加一个引导的servlet来设置扬鞭配置参数豆 -
You can add a Bootstrap servlet to set parameters for the Swagger config bean as described here -
的https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-Jersey-2.X-Project-Setup-1.5
这篇关于设置API版本与UI扬鞭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!