{
  "openapi": "3.0.0",
  "info": {
    "title": "Test API",
    "version": "1.0.0",
    "description": "Test API for generator v2"
  },
  "servers": [
    {
      "url": "https://api.example.com/v1"
    }
  ],
  "paths": {
    "/users": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "获取用户列表",
        "description": "获取所有用户的列表",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "页码",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "size",
            "in": "query",
            "description": "每页大小",
            "schema": {
              "type": "integer",
              "default": 10
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/User"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "User"
        ],
        "summary": "创建用户",
        "description": "创建一个新用户",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUserRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "创建成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/User"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/users/{id}": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "获取用户详情",
        "description": "根据ID获取用户详情",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "用户ID",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/User"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "User"
        ],
        "summary": "更新用户",
        "description": "更新用户信息",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "用户ID",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUserRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "更新成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "$ref": "#/components/schemas/User"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "User"
        ],
        "summary": "删除用户",
        "description": "删除指定用户",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "用户ID",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "删除成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/posts": {
      "get": {
        "tags": [
          "Post"
        ],
        "summary": "获取文章列表",
        "responses": {
          "200": {
            "description": "成功",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "integer"
                    },
                    "message": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Post"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "User": {
        "type": "object",
        "required": [
          "id",
          "name",
          "email"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "description": "用户ID"
          },
          "name": {
            "type": "string",
            "description": "用户名"
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "邮箱地址"
          },
          "avatar": {
            "type": "string",
            "description": "头像URL"
          },
          "status": {
            "$ref": "#/components/schemas/UserStatus"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "创建时间"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "更新时间"
          }
        }
      },
      "CreateUserRequest": {
        "type": "object",
        "required": [
          "name",
          "email"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "用户名"
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "邮箱地址"
          },
          "avatar": {
            "type": "string",
            "description": "头像URL"
          }
        }
      },
      "UpdateUserRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "用户名"
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "邮箱地址"
          },
          "avatar": {
            "type": "string",
            "description": "头像URL"
          },
          "status": {
            "$ref": "#/components/schemas/UserStatus"
          }
        }
      },
      "UserStatus": {
        "type": "string",
        "enum": [
          "active",
          "inactive",
          "banned"
        ],
        "description": "用户状态"
      },
      "Post": {
        "type": "object",
        "required": [
          "id",
          "title",
          "content",
          "authorId"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "description": "文章ID"
          },
          "title": {
            "type": "string",
            "description": "文章标题"
          },
          "content": {
            "type": "string",
            "description": "文章内容"
          },
          "authorId": {
            "type": "integer",
            "description": "作者ID"
          },
          "author": {
            "$ref": "#/components/schemas/User"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "标签列表"
          },
          "publishedAt": {
            "type": "string",
            "format": "date-time",
            "description": "发布时间"
          }
        }
      }
    }
  }
}