
{ "swagger": "2.0", "info": { "title": "示例 API 文檔", "description": "這是一個用于展示Swagger文檔結(jié)構(gòu)的示例。", "version": "1.0.0" }, "basePath": "/api", "schemes": ["http", "https"], "paths": { "/users": { "get": { "summary": "獲取用戶列表", "description": "返回所有用戶的詳細(xì)信息。", "produces": [ "application/json" ], "responses": { "200": { "description": "成功獲取用戶列表", "schema": { "$ref": "#/definitions/UserList" } } } } }, "/users/{id}": { "get": { "summary": "獲取單個用戶", "description": "根據(jù)用戶ID獲取用戶詳細(xì)信息。", "produces": [ "application/json" ], "parameters": [ { "name": "id", "in": "path", "type": "integer", "required": true, "description": "用戶的唯一標(biāo)識符" } ], "responses": { "200": { "description": "成功獲取單個用戶", "schema": { "$ref": "#/definitions/User" } } } } } }, "definitions": { "User": { "type": "object", "properties": { "id": { "type": "integer", "description": "用戶的唯一標(biāo)識符" }, "name": { "type": "string", "description": "用戶的顯示名稱" }, "email": { "type": "string", "format": "email", "description": "用戶的電子郵件地址" } } }, "UserList": { "type": "array", "items": { "$ref": "#/definitions/User" } } } }