
{ "swagger": "2.0", "info": { "title": "示例 API 文档", "description": "这是一个用于展示Swagger文档结构的示例。", "version": "1.0.0" }, "basePath": "/api", "schemes": ["http", "https"], "paths": { "/users": { "get": { "summary": "获取用户列表", "description": "返回所有用户的详细信息。", "produces": [ "application/json" ], "responses": { "200": { "description": "成功获取用户列表", "schema": { "$ref": "#/definitions/UserList" } } } } }, "/users/{id}": { "get": { "summary": "获取单个用户", "description": "根据用户ID获取用户详细信息。", "produces": [ "application/json" ], "parameters": [ { "name": "id", "in": "path", "type": "integer", "required": true, "description": "用户的唯一标识符" } ], "responses": { "200": { "description": "成功获取单个用户", "schema": { "$ref": "#/definitions/User" } } } } } }, "definitions": { "User": { "type": "object", "properties": { "id": { "type": "integer", "description": "用户的唯一标识符" }, "name": { "type": "string", "description": "用户的显示名称" }, "email": { "type": "string", "format": "email", "description": "用户的电子邮件地址" } } }, "UserList": { "type": "array", "items": { "$ref": "#/definitions/User" } } } }