Search code examples
restswaggerapi-designswagger-2.0swagger-editor

Getting a parse error with Swagger


My project requirements insist on writing API specification with Swagger. I am following this tutorial: APIHandyman

I have passed the following YAML into the UI:

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

I am getting this error in the compiler:

enter image description here

I will appreciate any pointers on this.


Solution

  • You can also try to import your swagger into this tool:

    https://apibldr.com

    It will also let you visually build your API definitions.