Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swagger 招摇过市发送和接收阵列_Swagger_Swagger 3.0 - Fatal编程技术网

Swagger 招摇过市发送和接收阵列

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:

我在请求中发送一个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:
      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”,如果这是您的意思的话。如果我使用了,我会得到一个错误
缺少属性
,因为我没有设置。