{
  "openapi": "3.1.1",
  "info": {
    "title": "MyApp.Api | v1",
    "version": "1.0.0"
  },
  "paths": {
    "/api/todos": {
      "get": {
        "tags": [
          "Todos"
        ],
        "summary": "Lists all todo items.",
        "responses": {
          "200": {
            "description": "Every todo item currently stored.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TodoDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TodoDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TodoDto"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Todos"
        ],
        "summary": "Creates a new todo item.",
        "requestBody": {
          "description": "The creation request body.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTodoRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTodoRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTodoRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/TodoDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TodoDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/TodoDto"
                }
              }
            }
          },
          "400": {
            "description": "The request body is missing or has an empty title.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    },
    "/api/todos/{id}": {
      "get": {
        "tags": [
          "Todos"
        ],
        "summary": "Returns a single todo item by identifier.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The identifier of the item.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/TodoDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TodoDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/TodoDto"
                }
              }
            }
          },
          "404": {
            "description": "No item with the given identifier exists.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Todos"
        ],
        "summary": "Sets the completion state of a todo item.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The identifier of the item.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "The new completion state.",
          "content": {
            "application/json": {
              "schema": {
                "type": "boolean"
              }
            },
            "text/json": {
              "schema": {
                "type": "boolean"
              }
            },
            "application/*+json": {
              "schema": {
                "type": "boolean"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/TodoDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TodoDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/TodoDto"
                }
              }
            }
          },
          "404": {
            "description": "No item with the given identifier exists.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Todos"
        ],
        "summary": "Deletes a todo item.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "The identifier of the item.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "404": {
            "description": "No item with the given identifier exists.",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreateTodoRequest": {
        "required": [
          "title"
        ],
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "description": "The title of the new item."
          }
        },
        "description": "Data for creating a new todo item."
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": [
              "null",
              "string"
            ]
          },
          "title": {
            "type": [
              "null",
              "string"
            ]
          },
          "status": {
            "pattern": "^-?(?:0|[1-9]\\d*)$",
            "type": [
              "null",
              "integer",
              "string"
            ],
            "format": "int32"
          },
          "detail": {
            "type": [
              "null",
              "string"
            ]
          },
          "instance": {
            "type": [
              "null",
              "string"
            ]
          }
        }
      },
      "TodoDto": {
        "required": [
          "id",
          "title",
          "isCompleted"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The stable identifier of the item.",
            "format": "uuid"
          },
          "title": {
            "type": "string",
            "description": "The human-readable title of the item."
          },
          "isCompleted": {
            "type": "boolean",
            "description": "A value indicating whether the item is done."
          }
        },
        "description": "Data-transfer shape of a todo item exposed by the application layer."
      }
    }
  },
  "tags": [
    {
      "name": "Todos"
    }
  ]
}