使用Swagger获得解析错误

时间:2017-05-02 11:50:28

标签: rest swagger api-design swagger-2.0 swagger-editor

我的项目要求坚持用Swagger编写API规范。我正在学习本教程:APIHandyman

我已将以下YAML传递到用户界面:

swagger: '2.0'

info:
  version: '1.0.0'
  title: 'Simple API'
  description: 'A simple API to learn how to write OPEN API Specificaiton'

# Added by API Auto Mocking Plugin
host: virtserver.swaggerhub.com
basePath: /xxxxxxx/Simple_API/1.0.0
schemes:
 - https

paths:
  /persons:
    get:
      summary: Gets some persons
      description: Returns a list containing all persons.
      responses:
        200:
          description: A list of Person
          schema:
            type: array
            items:
              required:
                - username
              properties:
                firstName:
                  type: string
                lastName:
                  type: string
                username:
                  type: string

我在编译器中收到此错误:

enter image description here

我将很感激任何指示。

1 个答案:

答案 0 :(得分:-1)

您也可以尝试将招摇信息导入此工具:

https://apibldr.com

它还可以让您直观地构建API定义。