我在 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/,支持在参数中描述:正文
以为招摇编辑器正在抛出错误。这里可能出了什么问题?图式?
任何帮助,不胜感激。谢谢。
在 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'
您发布的文档链接适用于 OpenAPI 2.0。对于 OpenAPI 3.0,请使用此链接:
https://swagger.io/docs/specification/describing-request-body/