使用招摇的Web API文档 [英] Web API Documentation using swagger
问题描述
我是新来招摇,我见过几个在线文档来实现扬鞭我的WebAPI和使用的一些SwaggerConfig的属性来定制。
I am new to swagger, I have seen couple of online documentation to implement Swagger to my webapi and used some of the properties of SwaggerConfig to customize.
下面是我的要求: -
我需要显示招摇文档只能在资源管理器的基础上API_KEY文本框应该配合我的app.config项的值按一下按钮
Here is my requirement :- I need to show swagger documentation only on "Explore" button click based on the value of "API_Key" TextBox which should match with my app.config key.
所以,我看到了实现这样的: -
So I am seeing to implement like this:-
- 用户来我昂首阔步主页,默认情况下它会产生空的文档,除非在图像中显示的标题。
- 进入API_KEY在文本框中的标题提供,然后点击浏览。
- 输入的API密钥进行验证,在我的app.config键或如果可能的话在SwaggerConfig。
- 如果验证显示文档否则显示错误信息为无效API密钥。
- User comes to my swagger home page, by default it will have empty documentation, except the header as shown in the image.
- Enters API_Key in the textbox provided in the header and click on Explore.
- Entered API key is validated with the key in my app.config or if possible in the SwaggerConfig.
- If validated show documentation else show error message as invalid API key.
需要的建议。
亲切的问候,
Raghu
Kind Regards, Raghu
推荐答案
只需编辑 index.html的
并添加您需要的 addApiKeyAuthorization
更改事件的标题。查看更多在这里:
Simply edit the index.html
and add the headers you need on the addApiKeyAuthorization
change event. See more here:
https://github.com/swagger-api/swagger-ui#header-parameters
这篇关于使用招摇的Web API文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!