120 lines
3.8 KiB
JSON
120 lines
3.8 KiB
JSON
{
|
||
"swagger": "2.0",
|
||
"info": {
|
||
"title": "go-gin-api docs api",
|
||
"contact": {}
|
||
},
|
||
"host": "127.0.0.1:9999",
|
||
"paths": {
|
||
"/demo/user/{name}": {
|
||
"get": {
|
||
"description": "获取用户信息",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Demo"
|
||
],
|
||
"summary": "获取用户信息",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "用户名(Tom)",
|
||
"name": "name",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "签名",
|
||
"name": "Authorization",
|
||
"in": "header",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "用户信息",
|
||
"schema": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "object",
|
||
"properties": {
|
||
"job": {
|
||
"description": "工作",
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"description": "用户名",
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/user/login": {
|
||
"post": {
|
||
"description": "登录获取 Authorization 码",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"Demo"
|
||
],
|
||
"summary": "登录获取 Authorization 码",
|
||
"parameters": [
|
||
{
|
||
"description": "请求信息",
|
||
"name": "loginRequest",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/demo.loginRequest"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "签名信息",
|
||
"schema": {
|
||
"$ref": "#/definitions/demo.loginResponse"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"definitions": {
|
||
"demo.loginRequest": {
|
||
"type": "object",
|
||
"properties": {
|
||
"user_id": {
|
||
"description": "用户ID(\u003e0)",
|
||
"type": "integer"
|
||
},
|
||
"user_name": {
|
||
"description": "用户名",
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"demo.loginResponse": {
|
||
"type": "object",
|
||
"properties": {
|
||
"authorization": {
|
||
"description": "签名",
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} |