2021-01-08 23:35:08 +08:00

197 lines
4.0 KiB
YAML

---
swagger: "2.0"
info:
version: ""
title: ""
schemes:
- "http"
- "https"
consumes:
- "application/json"
produces:
- "application/json"
paths:
/api/user/login:
post:
tags:
- "user-api"
summary: "登录"
operationId: "login"
parameters:
- in: "body"
name: "body"
required: true
schema:
$ref: "#/definitions/LoginReq"
x-exportParamName: "Body"
responses:
"200":
description: "A successful response."
schema: {}
/api/user/register:
post:
tags:
- "user-api"
summary: "注册"
description: "注册一个用户"
operationId: "register"
parameters:
- in: "body"
name: "body"
required: true
schema:
$ref: "#/definitions/RegisterReq"
x-exportParamName: "Body"
responses:
"200":
description: "A successful response."
schema: {}
/api/user/search:
get:
tags:
- "user-api"
summary: "用户搜索"
operationId: "searchUser"
parameters:
- in: "body"
name: "body"
required: true
schema:
$ref: "#/definitions/UserSearchReq"
x-exportParamName: "Body"
responses:
"200":
description: "A successful response."
schema:
$ref: "#/definitions/UserSearchReply"
/api/user/{id}:
get:
tags:
- "user-api"
summary: "获取用户信息"
operationId: "getUserInfo"
parameters:
- name: "id"
in: "path"
required: true
type: "string"
x-exportParamName: "Id"
- in: "body"
name: "body"
required: true
schema:
$ref: "#/definitions/UserInfoReq"
x-exportParamName: "Body"
responses:
"200":
description: "A successful response."
schema:
$ref: "#/definitions/UserInfoReply"
/user/ping:
get:
tags:
- "greet"
operationId: "ping"
parameters: []
responses:
"200":
description: "A successful response."
schema: {}
securityDefinitions:
apiKey:
description: "Enter JWT Bearer token **_only_**"
type: "apiKey"
name: "Authorization"
in: "header"
definitions:
LoginReq:
type: "object"
properties:
username:
type: "string"
password:
type: "string"
title: "LoginReq"
example:
password: "password"
username: "username"
RegisterReq:
type: "object"
properties:
username:
type: "string"
password:
type: "string"
mobile:
type: "string"
title: "RegisterReq"
example:
password: "password"
mobile: "mobile"
username: "username"
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"
example:
birthday: "birthday"
name: "name"
description: "description"
tag:
- "tag"
- "tag"
age: 0
UserInfoReq:
type: "object"
properties:
id:
type: "string"
title: "UserInfoReq"
example:
id: "id"
UserSearchReply:
type: "object"
properties:
KeyWord:
type: "array"
items:
$ref: "#/definitions/UserInfoReply"
title: "UserSearchReply"
example:
KeyWord:
- birthday: "birthday"
name: "name"
description: "description"
tag:
- "tag"
- "tag"
age: 0
- birthday: "birthday"
name: "name"
description: "description"
tag:
- "tag"
- "tag"
age: 0
UserSearchReq:
type: "object"
properties:
keyWord:
type: "string"
title: "UserSearchReq"
example:
keyWord: "keyWord"