SwaggerUI / YAML - 报告:不应该有其他属性additionalProperty:requestBody

时间:2018-03-14 09:01:57

标签: swagger-2.0

我正在尝试定义一个swagger文件但是收到此错误。

Schema error at paths['/ShipmentRequest'].post
should NOT have additional properties
additionalProperty: requestBody
Jump to line 20

我需要定义输入是正文中的JSON。 我仔细检查过,我没有在2.0之间混合格式。和3.0。

swagger: '2.0'
info:
  version: 1.0.0
  title: ShipmentRequest
  description: The API enables you to manage creation ordes. 
host: myhost.com
schemes:
  - https
securityDefinitions:
  basicAuth:
    type: basic
    description: Username and password
basePath: /rest
consumes:
  - application/json
produces:
  - application/json
paths:
  /ShipmentRequest:
    post:
      summary: >-
        This is a request to create order of shipment. API is using
        API Key Authentication.
        Request will return JSON.
      requestBody:
        requierd: true
        content: 
          application/json:
            schema:            
              $ref: '#/definitions/RequestFormat'
      security:
        - basicAuth: []
      tags:
        - ShipmentRequest
      responses:
        '200':
          description: Success
          schema:
            $ref: '#/definitions/ResponseFormat'

当我尝试使用https://swagger.io/docs/specification/2-0/describing-request-body/中描述的格式时,它报告了我同样的问题,但有属性"参数"

  parameters:
    - in: body
      name: user
      description: The user to create.
      schema:
        $ref: "#/definitions/User"     # <----------

如何正确设置消费者配置?

0 个答案:

没有答案