如何修复Swagger编辑器中的“映射条目缩进缩进”错误?

时间:2019-07-19 18:19:23

标签: swagger swagger-2.0 swagger-editor

我正在为REST API创建一个OpenAPI(Swagger)定义。 Swagger编辑器报告了我的定义中的3个错误。我该如何解决这些错误?

swagger: '2.0'
info:
  description: This is a simple for MedApp
  version: 1.0.0
  title: Simple API

  contact:
    email: you@your-company.com

  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html

# tags are used for organizing operations
tags:

- name: developers
  description: Operations available to regular developers
- name: users
  description: Operations available to users (diagnosis, personal data)


paths:
  /pharmacy:
    post:
      tags:
      - developers
      summary: searching of pharmacies with aavilable medicines
      operationId: SearchPharm
      description: Searching of pharmacies with available medicines which were identified one step earlier 

      consumes:
      - application/json

      produces:
      - application/json

      parameters:
      - in: body
        name: objectpharm
        type: object
        description: Inventory item to add
        required: true
        items:
          $ref: '#/definitions/test/InputData'

      responses:
        200:
          description: item created
          type: object
          items: 
            $ref: '#/definitions/test/OutputData'

        400:
          description: invalid input

        409:
          description: pharmacy was not found, it will be better if you will consult a doctor
ERROR 1)=>    message: 
                type: string
                example: Pharmacy was not found, it will be better if you will consult a doctor. Would you like to sign up for a doctor?




definitions:
  test:
ERROR 2)=>    InputData:
      type: object
        required:
        - title
        - doze
        - amount
        - shipDate
        properties:
ERROR 3)=>          title:
            type: string
          doze:
            type: string
            example: 5mg
          amount:
            type: integer
            format: int32
          shipDate:
            type: string
            format: date-time

  OutputData:                  
    type: object 
    required: 
    - pharm_title
    - address
    - cost
    - getDate
    - reservation
    - telephone
    - site
    - payment
    - complete 
    properties:
      pharm_title:
        type: string
      address:
        type: string
      cost:
        type: number
        format: double
        minimum: 0 
        exclusiveMinimum: true
      getDate: {должен быть промежуток времени}
        type: string
        format: date-time
      reservation:
        type: integer
      telephone:
        type: string
      site:
        type: string
        format: url
        example:  https://www.acme-corp.com
      payment: 
        type: string
        description: Kind of payment
        enum:
        - by cash
        - non-cash
        - any
      complete:
        type: boolean
        default: false

host: virtserver.swaggerhub.com
basePath: /danilko99/T3.1/1.0.0
schemes:
 - https

错误消息是:

  

1)映射条目缩进错误

     

2)不应具有其他属性extraProperty:类型,项目

     

3)不应具有其他属性extraProperty:类型,项目

0 个答案:

没有答案