OpenAPI 3.0 文件格式在参数中给出了 allowedValues 周围的错误

Eni*_*gma 4 swagger-ui swagger-editor openapi

我在 OAS 3.0 中指定了 API 规范

post:
  tags:
    - One Time Payment
  summary: One Time Payment API
  operationId: oneTimePaymentUsingPOST
  parameters:
    - in: body
      name: realTimePaymentRequest
      description: realTimePaymentRequest
      required: true
      schema:
        $ref: '#/components/schemas/RealTimePaymentRequest'
Run Code Online (Sandbox Code Playgroud)

当我在https://editor.swagger.io/ 中编辑此规范文件时- 它抛出的错误为:

Structural error at paths./banks/payments.post.parameters.0.in
should be equal to one of the allowed values
allowedValues: path, query, header, cookie
Run Code Online (Sandbox Code Playgroud)

我可以看到按照https://swagger.io/docs/specification/2-0/describing-request-body/支持参数中的描述:body

认为 Swagger 编辑器抛出错误。这里有什么问题?架构?

任何帮助表示赞赏。谢谢你。

Hel*_*len 5

在OpenAPI的3.0,in: bodyin: formData参数替换为requestBody

post:
  tags:
    - One Time Payment
  summary: One Time Payment API
  operationId: oneTimePaymentUsingPOST

  requestBody:
    description: realTimePaymentRequest
    required: true
    content:
      application/json:
        schema:
          $ref: '#/components/schemas/RealTimePaymentRequest'
Run Code Online (Sandbox Code Playgroud)

您发布的文档链接适用于 OpenAPI 2.0。对于 OpenAPI 3.0,请使用此链接:https ://swagger.io/docs/specification/describing-request-body/