{
  "openapi": "3.0.3",
  "info": {
    "title": "Sample API",
    "version": "1.0.0",
    "description": "샘플 스펙. 백엔드가 준비되면 `yarn codegen:sync`로 실제 OpenAPI 문서를 내려받아 이 파일을 덮어쓴다."
  },
  "servers": [{ "url": "https://jsonplaceholder.typicode.com" }],
  "paths": {
    "/posts": {
      "get": {
        "operationId": "getPosts",
        "summary": "글 목록 조회",
        "parameters": [
          {
            "name": "userId",
            "in": "query",
            "required": false,
            "schema": { "type": "integer" }
          }
        ],
        "responses": {
          "200": {
            "description": "글 목록",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": { "$ref": "#/components/schemas/Post" }
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "createPost",
        "summary": "글 생성",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/PostCreate" }
            }
          }
        },
        "responses": {
          "201": {
            "description": "생성된 글",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Post" }
              }
            }
          }
        }
      }
    },
    "/posts/{id}": {
      "get": {
        "operationId": "getPost",
        "summary": "글 단건 조회",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "integer" }
          }
        ],
        "responses": {
          "200": {
            "description": "글",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Post" }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "updatePost",
        "summary": "글 수정",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "integer" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/PostCreate" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "수정된 글",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Post" }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "deletePost",
        "summary": "글 삭제",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "integer" }
          }
        ],
        "responses": {
          "200": { "description": "삭제 완료" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Post": {
        "type": "object",
        "required": ["id", "userId", "title", "body"],
        "properties": {
          "id": { "type": "integer" },
          "userId": { "type": "integer" },
          "title": { "type": "string" },
          "body": { "type": "string" }
        }
      },
      "PostCreate": {
        "type": "object",
        "required": ["title", "body"],
        "properties": {
          "userId": { "type": "integer" },
          "title": { "type": "string" },
          "body": { "type": "string" }
        }
      }
    }
  }
}
