swagger 具有协议版本的API端点

o0lyfsai  于 7个月前  发布在  其他
关注(0)|答案(1)|浏览(87)

有谁知道在API规范文档中包含API端点中的协议版本有什么意义吗?
范例:

/pet/findByTags **HTTP/1.1**:
    get:
      tags:
        - pet
      summary: Finds Pets by tags
      description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
      operationId: findPetsByTags
      parameters:
        - name: tags
          in: query
          description: Tags to filter by
          required: false
          explode: true
          schema:
            type: array
            items:
              type: string

字符串
当我如上所述使用它时,swagger编辑器并没有抱怨,但我不确定这样做的目的。
我试着查看OpenApi规范的细节,但它没有提到上面的场景。

7y4bm7vi

7y4bm7vi1#

HTTP协议版本在OpenAPI规范中没有具体定义,并且不以任何方式被识别或支持。该规范假设使用“HTTPAPI”并且在引用headers时仅引用HTTP/1.1status codes和可接受的安全性schemes。HTTP/2是向后兼容的,在HTTP/2上描述HTTP/2 API没有重大变化。1.1与OpenAPI规范相关的API。HTTP/2 API所需的任何新头值都按照RFC 7230以与HTTP/1.1 API相同的方式定义。此RFC概述了http规范的实现应如何处理新头值。

相关问题