我正在使用 tornado-rest-swagger==1.1.3 来编写我在 tornado 框架上编写的项目。
除了授权之外,一切正常,添加了主要授权并且可以锁定,但每个端点上的授权都是 emphy 并且没有从 swagger 发送标头。
将不胜感激任何帮助
# swagger setup
from tornado_swagger.setup import setup_swagger
if __name__ == '__main__':
setup_swagger(
routes,
swagger_url="/api/affiliate",
description="",
api_version="1.0.0",
title="Affiliate API",
)
@components.security_schemes.register
class Authorization(object):
"""
---
type: apiKey
in: header
name: Authorization
"""
handler
class Countries(AffiliateBaseHandler, ABC):
def initialize(self, *args, **kwargs):
super(Countries, self).initialize(*args, **kwargs)
@authenticated()
@coroutine
def get(self):
"""
---
security:
- ApiKeyAuth: []
tags:
- Helpers
summary: Countries list
operationId: countries_list
parameters:
- in: header
name: Authorization
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/CountryResponse'
UnauthorizedError:
description: Access token is missing or invalid
"""
我添加了一些屏幕截图以查看确切的问题
当从主授权授权时,可以在屏幕截图上看到主授权被锁定但在端点上没有任何改变
在第二个屏幕截图上,如果我转到端点并按下锁,则没有可用的授权