Swagger 2.0将Accept-Language标头作为请求参数

3

我正在使用Swagger 2.0为http API编写规范。

我该如何将Accept-Language标头定义为路径的必需标头参数?

/aPath:
post:
  parameters:
    - in: header
      name: Accept-Language
      type: string
      enum: [de, en, es]
      required: true
  responses:
    200:
      description: The Best
      schema:
        type: string

关于 header 参数的文档指出:

Swagger 规范对一些特定的头部参数有专门的关键词: enter image description here

如何使用 keyword "produces" 来定义 Accept-Language 头部参数?

1个回答

2

您的定义是正确的。

您提到的页面讨论的是 Accept 头部,它与 Accept-Language 不同。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接