【发布时间】:2021-06-07 09:27:44
【问题描述】:
我正在尝试为我正在开发的 API 编写开放 API 规范 (V3),并在定义接受标头时遇到问题。在我的规范中,定义接受头如下:
parameters:
- in: header
name: Accept
required: true
description: Defines the media type and version of the API endpoint
schema:
enum:
- 'application/vnd.iotdeviceenrollment.v1'
- 'application/json'
type: string
但我发现我使用了一个受限值“Accept”作为标题参数的名称: https://apisecurity.io/encyclopedia/content/oasv3/oasconformance/bestpractices/v3-warning-parameter-header-accept
因此,当我将 Open API 规范导出到 Azure APIM 时,接受标头不可见并被忽略。
如果是这种情况,在 Open API 规范 V3 中定义接受标头的正确方法是什么
注意:使用 Open API SwaggerUI 进行测试时,我可以在 UI 预览中看到接受标头值。
【问题讨论】:
标签: swagger swagger-ui openapi azure-api-management