bbs/app/http/swagger/swagger.yaml

399 lines
8.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

basePath: /
definitions:
qa.AnswerDTO:
properties:
author:
allOf:
- $ref: '#/definitions/user.UserDTO'
description: 作者
content:
type: string
created_at:
type: string
id:
type: integer
updated_at:
type: string
type: object
qa.QuestionDTO:
properties:
answer_num:
type: integer
answers:
description: 回答
items:
$ref: '#/definitions/qa.AnswerDTO'
type: array
author:
allOf:
- $ref: '#/definitions/user.UserDTO'
description: 作者
context:
description: 在列表页只显示前200个字符
type: string
created_at:
type: string
id:
type: integer
title:
type: string
updated_at:
type: string
type: object
qa.answerCreateParam:
properties:
context:
type: string
questionId:
type: integer
required:
- context
- questionId
type: object
qa.answerDeleteParam:
properties:
answerId:
type: integer
required:
- answerId
type: object
qa.questionCreateParam:
properties:
content:
type: string
title:
type: string
required:
- content
- title
type: object
qa.questionDeleteParam:
properties:
questionId:
type: integer
required:
- questionId
type: object
qa.questionDetailParam:
properties:
questionId:
type: integer
required:
- questionId
type: object
qa.questionEditParam:
properties:
content:
type: string
id:
type: integer
title:
type: string
required:
- content
- id
- title
type: object
qa.questionListParam:
properties:
size:
type: integer
start:
type: integer
required:
- size
- start
type: object
user.UserDTO:
properties:
created_at:
type: string
id:
type: integer
user_name:
type: string
type: object
user.loginParam:
properties:
password:
minLength: 6
type: string
username:
type: string
required:
- password
- username
type: object
user.registerParam:
properties:
email:
minLength: 6
type: string
password:
minLength: 6
type: string
username:
type: string
required:
- email
- password
- username
type: object
info:
contact:
email: yejianfeng
name: yejianfeng1
description: 这个模块负责显示hade的接口
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: https://github.com/swaggo/swag
title: hade
version: "1.1"
paths:
/answer/create:
post:
consumes:
- application/json
description: 创建回答
parameters:
- description: 创建回答参数
in: body
name: answerCreateParam
required: true
schema:
$ref: '#/definitions/qa.answerCreateParam'
produces:
- application/json
responses:
"200":
description: 操作成功
schema:
type: string
summary: 创建回答
tags:
- qa
/answer/delete:
post:
consumes:
- application/json
description: 创建回答
parameters:
- description: 删除id
in: body
name: answerDeleteParam
required: true
schema:
$ref: '#/definitions/qa.answerDeleteParam'
produces:
- application/json
responses:
"200":
description: 操作成功
schema:
type: string
summary: 创建回答
tags:
- qa
/question/create:
post:
consumes:
- application/json
description: 创建问题
parameters:
- description: 创建问题参数
in: body
name: questionCreateParam
required: true
schema:
$ref: '#/definitions/qa.questionCreateParam'
produces:
- application/json
responses:
"200":
description: 操作成功
schema:
type: string
summary: 创建问题
tags:
- qa
/question/delete:
post:
consumes:
- application/json
description: 删除问题,同时删除问题中的所有答案
parameters:
- description: 删除id
in: body
name: questionDeleteParam
required: true
schema:
$ref: '#/definitions/qa.questionDeleteParam'
produces:
- application/json
responses:
"200":
description: 操作成功
schema:
type: string
summary: 删除问题
tags:
- qa
/question/detail:
post:
consumes:
- application/json
description: 获取问题详情,包括问题的所有回答
parameters:
- description: 问题id
in: body
name: questionDetailParam
required: true
schema:
$ref: '#/definitions/qa.questionDetailParam'
produces:
- application/json
responses:
"200":
description: 问题详情,带回答和作者
schema:
type: QuestionDTO
summary: 获取问题详细
tags:
- qa
/question/edit:
post:
consumes:
- application/json
description: 编辑问题
parameters:
- description: 编辑问题参数
in: body
name: questionEditParam
required: true
schema:
$ref: '#/definitions/qa.questionEditParam'
produces:
- application/json
responses:
"200":
description: 操作成功
schema:
type: string
summary: 编辑问题
tags:
- qa
/question/list:
post:
consumes:
- application/json
description: 获取问题列表,包含作者信息,不包含回答
parameters:
- description: 分页查询的参数
in: body
name: questionListParam
required: true
schema:
$ref: '#/definitions/qa.questionListParam'
produces:
- application/json
responses:
"200":
description: 问题列表
schema:
items:
$ref: '#/definitions/qa.QuestionDTO'
type: array
summary: 获取问题列表
tags:
- qa
/user/login:
post:
consumes:
- application/json
parameters:
- description: login with param
in: body
name: loginParam
required: true
schema:
$ref: '#/definitions/user.loginParam'
produces:
- application/json
responses:
"200":
description: token
schema:
type: string
summary: 用户登录
tags:
- user
/user/logout:
get:
consumes:
- application/json
description: 调用表示用户登出
produces:
- application/json
responses:
"200":
description: 用户登出成功
schema:
type: string
summary: 用户登出
tags:
- user
/user/register:
post:
consumes:
- application/json
description: 用户注册接口
parameters:
- description: 注册参数
in: body
name: registerParam
required: true
schema:
$ref: '#/definitions/user.registerParam'
produces:
- application/json
responses:
"200":
description: 注册成功
schema:
type: string
summary: 用户注册
tags:
- user
/user/register/verify:
get:
consumes:
- application/json
description: 使用token验证用户注册信息
parameters:
- description: 注册token
in: query
name: token
required: true
type: string
produces:
- application/json
responses:
"200":
description: 注册成功,请进入登录页面
schema:
type: string
summary: 验证注册信息
tags:
- user
securityDefinitions:
ApiKeyAuth:
in: header
name: Authorization
type: apiKey
BasicAuth:
type: basic
swagger: "2.0"
x-extension-openapi:
example: value on a json format