﻿{
  "openapi": "3.1.2",
  "info": {
    "title": "Sample | unions",
    "version": "1.0.0"
  },
  "paths": {
    "/unions/pet": {
      "get": {
        "tags": [
          "Sample"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnionPet"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Sample"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UnionPet"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnionPet"
                }
              }
            }
          }
        }
      }
    },
    "/unions/value": {
      "get": {
        "tags": [
          "Sample"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnionIntString"
                }
              }
            }
          }
        }
      }
    },
    "/unions/clinic": {
      "get": {
        "tags": [
          "Sample"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Clinic"
                }
              }
            }
          }
        }
      }
    },
    "/unions/typed-result": {
      "get": {
        "tags": [
          "Sample"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnionPet"
                }
              }
            }
          }
        }
      }
    },
    "/unions/any-of": {
      "get": {
        "tags": [
          "Sample"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Clinic"
                    },
                    {
                      "$ref": "#/components/schemas/UnionPet"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/unions/any-of-unions": {
      "get": {
        "tags": [
          "Sample"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/UnionIntString"
                    },
                    {
                      "$ref": "#/components/schemas/UnionPet"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/unions/multi-content-type": {
      "get": {
        "tags": [
          "Sample"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnionPet"
                }
              }
            }
          }
        }
      }
    },
    "/unions/kitten-standalone": {
      "get": {
        "tags": [
          "Sample"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Kitten"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Clinic": {
        "required": [
          "address",
          "patient"
        ],
        "type": "object",
        "properties": {
          "address": {
            "type": "string"
          },
          "patient": {
            "$ref": "#/components/schemas/UnionPet"
          }
        }
      },
      "Kitten": {
        "required": [
          "name",
          "lives"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "lives": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "Puppy": {
        "required": [
          "name",
          "breed"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "breed": {
            "type": "string"
          }
        }
      },
      "UnionIntString": {
        "anyOf": [
          {
            "type": "integer",
            "format": "int32"
          },
          {
            "type": "string"
          }
        ]
      },
      "UnionPet": {
        "type": "object",
        "anyOf": [
          {
            "$ref": "#/components/schemas/Kitten"
          },
          {
            "$ref": "#/components/schemas/Puppy"
          }
        ]
      }
    }
  },
  "tags": [
    {
      "name": "Sample"
    }
  ]
}