我尝试为SecurityDefinition构建Swagger设置,以获得以下结果openapi.json公司名称:
"securityDefinitions": {
"password": {
"type": "oauth2",
"tokenUrl": "http://example.com/oauth/token",
"flow": "password",
"scopes": {
"write": "allows modifying resources",
"read": "allows reading resources"
}
}
},
"security": [{
"password": ["read", "write"]
}]
在我的设置.py我添加了以下招摇设置:
^{pr2}$问题是openapi.json它由Swagger生成,没有security
dict,我不知道它是如何生成的。在
下面,展示了生成的openapi.json公司名称:
{
"info": {
"title": "Example Service API",
"version": ""
},
"host": "http://example.com",
"swagger": "2.0",
"securityDefinitions": {
"password": {
"type": "oauth2",
"scopes": {
"write": "allows modifying resources",
"read": "allows reading resources"
},
"tokenUrl": "http://example.com/oauth/token",
"flow": "password"
}
},
"paths": {...}
}
有没有更好的方式来描述这个概念在我的招摇过市的设置? 或者你能描述一下这个过程是什么,以及它是如何工作的,以便生成openapi.json文件?在
如果有疑问,请检查代码。您可以看到OpenAPIRenderer here的定义:
这样做的一种方法是子类化,例如:
^{pr2}$然后您可以将此呈现器类用于视图。希望有帮助!在
相关问题 更多 >
编程相关推荐