Swagger 招摇过市发送和接收阵列
我在请求中发送一个dataInfo并在响应中获取一个dataInfoStatus,但我希望发送和数组dataInfo并获取数组dataInfo status 我尝试了以下几点:Swagger 招摇过市发送和接收阵列,swagger,swagger-3.0,Swagger,Swagger 3.0,我在请求中发送一个dataInfo并在响应中获取一个dataInfoStatus,但我希望发送和数组dataInfo并获取数组dataInfo status 我尝试了以下几点: openapi: "3.0.0" info: title: project servers: - url: http://example1.net/v3 - url: http://example/v3 paths: /Pn/{PnId}/service1: post:
openapi: "3.0.0"
info:
title: project
servers:
- url: http://example1.net/v3
- url: http://example/v3
paths:
/Pn/{PnId}/service1:
post:
summary: Pn data
description: |
can Pn the data
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/dataInfo"
application/x-www-form-urlencoded:
schema:
$ref: "#/components/schemas/dataInfo"
parameters:
- name: PnId
in: path
description: PnId
required: true
schema:
$ref: "#/components/schemas/Pn"
responses:
'200':
description: status
content:
application/json:
schema:
$ref: "#/components/schemas/dataInfoStatus"
example: infoable
default:
description: error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
components:
schemas:
Error:
type: object
properties:
code:
type: integer
message:
type: string
required:
- message
Pn:
type: integer
format: int64
dataInfo:
type: string
dataInfoStatus:
type: string
enum: [infoable, non_infoable,ignorable]
但我明白了
分析器错误映射项的错误缩进
对于项目。我跟在后面
如何实现将请求中的dataInfo作为dataInfo数组发送,并获得dataInfoStatus数组的响应?您必须在
类型:
和数组
之间再添加一个空格,然后错误消息消失:
schema:
type:array
items:
$ref: "#/components/schemas/dataInfo"
您可以为添加
info.version
。您必须在类型:
和数组
之间再添加一个空格,然后错误消息消失:
schema:
type:array
items:
$ref: "#/components/schemas/dataInfo"
您可以为添加
info.version
。感谢您解决了错误:)。“并且您可以为openapi文件的版本添加info.version”,不能按照此操作吗?(我已经提到了上面的openapi版本:“3.0.0”,如果这是您的意思的话。如果我使用了,我会得到一个错误缺少属性
,因为我没有设置。感谢您解决了错误:)。“并且您可以为openapi文件的版本添加info.version”,不能按照此操作吗?(我已经提到了上面的openapi版本:“3.0.0”,如果这是您的意思的话。如果我使用了,我会得到一个错误缺少属性
,因为我没有设置。