rspec-openapi icon indicating copy to clipboard operation
rspec-openapi copied to clipboard

Accept empty array.

Open yasuzuki opened this issue 2 years ago • 0 comments

Current Behaviour

When generating a schema with a response with an empty array, the item property is marked as nullable.

responses:
  '200':
    content:
      application/json:
        schema:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              ...
            nullable: true

Desired Behaviour

Should generate schema of typed as an array with the unknown property rather than nullable for the array itself. Unknown property is expressed as properties: {} based on OAS 3.0.

reference: https://swagger.io/docs/specification/data-models/data-types/#array

When combined with other RSpec examples has a response with an array filled with any items, then generated schema should be merged correctly.

Thank you for this beautiful gem!

yasuzuki avatar Jun 30 '22 06:06 yasuzuki