Swagger 编辑器和会话 cookie

Swagger editor and session cookies

根据 this document,我可以使用:

components:
  securitySchemes:
    cookieAuth:
      type: apiKey
      in: cookie
      name: JSESSIONID

定义一个session cookie。但是如果你去the editor把第577行从in: "header"改成in: "cookie",小编责怪:

Schema error at securityDefinitions['api_key'].in should be equal to one of the allowed values allowedValues: header, query.

我必须如何定义基于会话 cookie 的身份验证?

Cookie 身份验证是 OpenAPI 3.0 的一项功能,在 OpenAPI 2.0 中不受支持。您的规范是 OpenAPI 2.0,如 securityDefinitions 所示。您不能混合使用 2.0 和 3.0 语法。您需要将规范重写或转换为 OpenAPI 3.0 格式。

也就是说,Cookie 身份验证目前在 Swagger UI 和 Swagger 编辑器中 not supported - 但在 SwaggerHub 中受支持。