Forum Discussion

ramuklawjju's avatar
ramuklawjju
New Contributor
4 years ago

Regarding OA3, for anyOf, oneOf, allOf refrences, what should be data type of the schema ?

In the below example, can the Cat or Dog be of scalar types ? like integer/string ? or only object type ?

 

 

paths:
  /pets:
    patch:
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/Cat'
                - $ref: '#/components/schemas/Dog'
      responses:
        '200':
          description: Updated
components:
  schemas:
    Dog:
      type: object
      properties:
        bark:
          type: boolean
        breed:
          type: string
          enum: [Dingo, Husky, Retriever, Shepherd]
    Cat:
      type: object
      properties:
        hunts:
          type: boolean
        age:
          type: integer

 

 

No RepliesBe the first to reply