{ "swagger": "2.0", "info": { "title": "type title here", "description": "type desc here", "version": "type version here" }, "schemes": [ "http", "https" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/api/user/login": { "post": { "summary": "登录", "operationId": "login", "responses": { "200": { "description": "A successful response.", "schema": {} } }, "parameters": [ { "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/LoginReq" } } ], "tags": [ "user-api" ] } }, "/api/user/register": { "post": { "summary": "注册", "operationId": "register", "responses": { "200": { "description": "A successful response.", "schema": {} } }, "parameters": [ { "name": "body", "description": "注册请求结构", "in": "body", "required": true, "schema": { "$ref": "#/definitions/RegisterReq" } } ], "tags": [ "user-api" ] } }, "/api/user/search": { "get": { "summary": "用户搜索", "operationId": "searchUser", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/UserInfoReply" } } }, "parameters": [ { "name": "keyWord", "description": " 关键词", "in": "query", "required": true, "type": "string" } ], "tags": [ "user-api" ] } }, "/api/user/{id}": { "get": { "summary": "获取用户信息", "operationId": "getUserInfo", "responses": { "200": { "description": "A successful response.", "schema": { "$ref": "#/definitions/UserInfoReply" } }, "400": { "description": "Error code list", "schema": { "example": "{\"100101\":\"out of authority\",\"100102\":\"user not exist\"}" } }, "500": { "description": "Server Error", "schema": { "$ref": "#/definitions/ErrorResponse" } } }, "parameters": [ { "name": "id", "in": "path", "required": true, "type": "string" } ], "tags": [ "user-api" ] } } }, "definitions": { "ErrorResponse": { "type": "object", "properties": { "code": { "type": "string" }, "message": { "type": "string" } }, "title": "ErrorResponse", "required": [ "code", "message" ] }, "LoginReq": { "type": "object", "properties": { "username": { "type": "string", "description": "测试" }, "password": { "type": "string", "description": "测试2" } }, "title": "LoginReq", "required": [ "username", "password" ] }, "RegisterReq": { "type": "object", "properties": { "username": { "type": "string" }, "password": { "type": "string" }, "mobile": { "type": "string" } }, "title": "RegisterReq", "required": [ "username", "password", "mobile" ] }, "UserInfoReply": { "type": "object", "properties": { "name": { "type": "string" }, "age": { "type": "integer", "format": "int32" }, "birthday": { "type": "string" }, "description": { "type": "string" }, "tag": { "type": "array", "items": { "type": "string" } }, "tags": { "type": "array", "items": { "type": "array", "items": { "type": "string" } } } }, "title": "UserInfoReply", "required": [ "name", "age", "birthday", "description", "tag", "tags" ] }, "UserInfoReq": { "type": "object", "title": "UserInfoReq" }, "UserSearchReq": { "type": "object", "properties": { "keyWord": { "type": "string", "description": " 关键词" } }, "title": "UserSearchReq", "required": [ "keyWord" ] } }, "securityDefinitions": { "apiKey": { "type": "apiKey", "description": "Enter JWT Bearer token **_only_**", "name": "Authorization", "in": "header" } } }