goctl-swagger/example/swagger.json
2021-01-08 23:35:08 +08:00

237 lines
4.7 KiB
JSON

{
"swagger": "2.0",
"info": {
"title": "",
"version": ""
},
"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": "注册",
"description": "注册一个用户",
"operationId": "register",
"responses": {
"200": {
"description": "A successful response.",
"schema": {}
}
},
"parameters": [
{
"name": "body",
"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/UserSearchReply"
}
}
},
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/UserSearchReq"
}
}
],
"tags": [
"user-api"
]
}
},
"/api/user/{id}": {
"get": {
"summary": "获取用户信息",
"operationId": "getUserInfo",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/UserInfoReply"
}
}
},
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/UserInfoReq"
}
}
],
"tags": [
"user-api"
]
}
},
"/user/ping": {
"get": {
"operationId": "ping",
"responses": {
"200": {
"description": "A successful response.",
"schema": {}
}
},
"tags": [
"greet"
]
}
}
},
"definitions": {
"LoginReq": {
"type": "object",
"properties": {
"username": {
"type": "string"
},
"password": {
"type": "string"
}
},
"title": "LoginReq"
},
"RegisterReq": {
"type": "object",
"properties": {
"username": {
"type": "string"
},
"password": {
"type": "string"
},
"mobile": {
"type": "string"
}
},
"title": "RegisterReq"
},
"UserInfoReply": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"age": {
"type": "integer",
"format": "int32"
},
"birthday": {
"type": "string"
},
"description": {
"type": "string"
},
"tag": {
"type": "array",
"items": {
"type": "string"
}
}
},
"title": "UserInfoReply"
},
"UserInfoReq": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
},
"title": "UserInfoReq"
},
"UserSearchReply": {
"type": "object",
"properties": {
"KeyWord": {
"type": "array",
"items": {
"$ref": "#/definitions/UserInfoReply"
}
}
},
"title": "UserSearchReply"
},
"UserSearchReq": {
"type": "object",
"properties": {
"keyWord": {
"type": "string"
}
},
"title": "UserSearchReq"
}
},
"securityDefinitions": {
"apiKey": {
"type": "apiKey",
"description": "Enter JWT Bearer token **_only_**",
"name": "Authorization",
"in": "header"
}
}
}