anyOf could be encoded via tupling options
paths:
/pets:
patch:
requestBody:
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/PetByAge'
- $ref: '#/components/schemas/PetByType'
responses:
'200':
description: Updated
components:
schemas:
PetByAge:
type: object
properties:
age:
type: integer
nickname:
type: string
required:
- age
PetByType:
type: object
properties:
pet_type:
type: string
hunts:
type: boolean
required:
- pet_type
could be encoded like
type PetByAge =
{ age: int
nickname: string }
type PetByType =
{ pet_type: string
hunts: bool }
type ``PetByAge or PetByType`` =
{ PetByAge: PetByAge option
PetByType: PetByType option }
anyOfcould be encoded via tupling optionscould be encoded like