0

I making swagger specs and I have an array of objects on my response. How can I remove this error "should NOT have additional properties additionalProperty: oneOf"

    acctBals:
      type: array
      items:
        oneOf:
          - $ref: '#/definitions/dog'
          - $ref: '#/definitions/cat'
          - $ref: '#/definitions/lion'
          - $ref: '#/definitions/wolf'
          - $ref: '#/definitions/tiger'

This is the example object inside the array.

   dog:
     type: object
     properties:
      balType:
        example: "Example"
        type: "string"
      curAmt:
        type: object
        properties:
         amt:
          example: 11000
          type: "number"
         curCode:
          example: "PHP"
          type: "string"
         curConvertRule:
          example: null
          type: "string"
         curRate:
          example: null
          type: "string"
Angelica
  • 29
  • 1
  • 7
  • OpenAPI 2.0 does not support `oneOf`, see [oneOf in Swagger schema does not work](https://stackoverflow.com/questions/36872277/oneof-in-swagger-schema-does-not-work). You'll need to migrate to OpenAPI 3.0 in order to use `oneOf`, or use workarounds suggested in [Equivalent use of oneOf (from OpenAPI 3) in OpenAPI 2](https://stackoverflow.com/q/70112647/113116) and [How to define a mixed-type array (with different element types) in OpenAPI 2.0?](https://stackoverflow.com/q/38690802/113116). – Helen Aug 22 '22 at 06:52

0 Answers0