icyleaf / swagger

Swagger contains a OpenAPI / Swagger universal documentation generator and HTTP server handler.
MIT License
41 stars 10 forks source link

Support array for Swagger::Objects::Schema #20

Closed erdnaxeli closed 3 years ago

erdnaxeli commented 3 years ago

Hi,

If I'm right, currently there is no way to do this:

    /pets:
      get:
        description: Returns all pets from the system that the user has access to
        responses:
          '200':
            description: A list of pets.
            content:
              application/json:
                schema:
                  type: array
                  items:
                    $ref: '#/components/schemas/pet'

Adding an item attribute to Swagger::Objects::Schema is enough. The struct must also become a class because item is itself of type Schema, and recursive structs are not allowed. I tested and it works.

If that's ok with you I could propose a PR.