OpenAPI 3.0 文件格式在参数中的 allowedValues 周围给出错误
OpenAPI 3.0 file format giving error around allowedValues in parameters
我在 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'
当我在 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
我可以看到根据 https://swagger.io/docs/specification/2-0/describing-request-body/
支持描述 in: body in parameters
认为 Swagger 编辑器抛出错误。这里有什么问题?架构 ?
感谢任何帮助。谢谢你。
在 OpenAPI 3.0 中,in: body
和 in: 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'
您发布的文档 link 适用于 OpenAPI 2.0。对于 OpenAPI 3.0,使用此 link:
https://swagger.io/docs/specification/describing-request-body/
我在 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'
当我在 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
我可以看到根据 https://swagger.io/docs/specification/2-0/describing-request-body/
支持描述 in: body in parameters认为 Swagger 编辑器抛出错误。这里有什么问题?架构 ?
感谢任何帮助。谢谢你。
在 OpenAPI 3.0 中,in: body
和 in: 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'
您发布的文档 link 适用于 OpenAPI 2.0。对于 OpenAPI 3.0,使用此 link:
https://swagger.io/docs/specification/describing-request-body/