How do you create a swagger schema that includes an array of varying types

OpenAPI 3.0 supports oneOf and anyOf:

      schema:
        type: array
        items:
          oneOf:
            - $ref: '#/components/schemas/directiveRequire'
            - $ref: '#/components/schemas/directiveReplace'
            - ...

In OpenAPI 2.0, you can define an object with varying properties as just type: object (free-form object). For your case, you may want to do this:

      schema:
        type: array
        items:
          type: object

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)