﻿{
  "openapi": "3.0.4",
  "info": {
    "title": "Sample | responses",
    "version": "1.0.0"
  },
  "paths": {
    "/responses/200-add-xml": {
      "get": {
        "tags": [
          "Sample"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Todo"
                }
              },
              "text/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Todo"
                }
              }
            }
          }
        }
      }
    },
    "/responses/200-only-xml": {
      "get": {
        "tags": [
          "Sample"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/xml": {
                "schema": {
                  "$ref": "#/components/schemas/Todo"
                }
              }
            }
          }
        }
      }
    },
    "/responses/triangle": {
      "get": {
        "tags": [
          "Sample"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Triangle"
                }
              }
            }
          }
        }
      }
    },
    "/responses/shape": {
      "get": {
        "tags": [
          "Sample"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Shape"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Shape": {
        "required": [
          "$type"
        ],
        "type": "object",
        "anyOf": [
          {
            "$ref": "#/components/schemas/ShapeTriangle"
          },
          {
            "$ref": "#/components/schemas/ShapeSquare"
          }
        ],
        "discriminator": {
          "propertyName": "$type",
          "mapping": {
            "triangle": "#/components/schemas/ShapeTriangle",
            "square": "#/components/schemas/ShapeSquare"
          }
        }
      },
      "ShapeSquare": {
        "properties": {
          "$type": {
            "enum": [
              "square"
            ],
            "type": "string"
          },
          "area": {
            "type": "number",
            "format": "double"
          },
          "color": {
            "type": "string"
          },
          "sides": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "ShapeTriangle": {
        "properties": {
          "$type": {
            "enum": [
              "triangle"
            ],
            "type": "string"
          },
          "hypotenuse": {
            "type": "number",
            "format": "double"
          },
          "color": {
            "type": "string"
          },
          "sides": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "Todo": {
        "required": [
          "id",
          "title",
          "completed",
          "createdAt"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "description": "The unique identifier of the to-do item.",
            "format": "int32"
          },
          "title": {
            "type": "string",
            "description": "The title of the to-do item."
          },
          "completed": {
            "type": "boolean",
            "description": "Indicates whether the to-do item is completed."
          },
          "createdAt": {
            "type": "string",
            "description": "The date and time when the to-do item was created.",
            "format": "date-time"
          }
        },
        "description": "Represents a to-do item."
      },
      "Triangle": {
        "type": "object",
        "properties": {
          "hypotenuse": {
            "type": "number",
            "format": "double"
          },
          "color": {
            "type": "string"
          },
          "sides": {
            "type": "integer",
            "format": "int32"
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Sample"
    }
  ]
}