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