我正在寻找一种适当的方法来指定带有自定义类型的Authorization标头,例如openAPI 3中的ApiKey。
自定义授权标头应类似于
授权:ApiKey myAPIKeyHere
我所有尝试使用apiKey类型指定securitySchemes条目的尝试都似乎产生其他结果...
我最接近的是:
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: ApiKey
...但是,密钥不在授权标头中。
如何指定这样的要求?
我想我已经找到了一种似乎可以接受的方法-尽管并不完美。希望以后看到更好的东西...
似乎除了将自定义类型添加到值之外,别无其他方法(如下所示的帮助。)>
components: securitySchemes: ApiKey: type: apiKey name: Authorization in: header description: 'Prefix the value with \"ApiKey\" to indicate the custom authorization type' security: - ApiKey: []
这至少会在curl中产生正确的标题(如果正确应用)。
请尝试以下方法: