fix: swagger wrong request parameter

This commit is contained in:
LinkinStar 2022-11-02 16:01:17 +08:00
parent 1bcd3abbcb
commit 0ce3b14bd2
4 changed files with 153 additions and 252 deletions

View File

@ -62,12 +62,6 @@ const docTemplate = `{
"description": "answer id or question title",
"name": "query",
"in": "query"
},
{
"type": "string",
"description": "question id",
"name": "question_id",
"in": "query"
}
],
"responses": {
@ -119,8 +113,41 @@ const docTemplate = `{
}
}
},
"/answer/admin/api/dashboard": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "DashboardInfo",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "DashboardInfo",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.RespBody"
}
}
}
}
},
"/answer/admin/api/language/options": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Get language options",
"produces": [
"application/json"
@ -482,14 +509,14 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
"description": "Get siteinfo general",
"description": "get site general information",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo general",
"summary": "get site general information",
"responses": {
"200": {
"description": "OK",
@ -517,14 +544,14 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
"description": "Get siteinfo interface",
"description": "update site general information",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo interface",
"summary": "update site general information",
"parameters": [
{
"description": "general",
@ -553,25 +580,14 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
"description": "Get siteinfo interface",
"description": "get site interface",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo interface",
"parameters": [
{
"description": "general",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/schema.AddCommentReq"
}
}
],
"summary": "get site interface",
"responses": {
"200": {
"description": "OK",
@ -599,14 +615,14 @@ const docTemplate = `{
"ApiKeyAuth": []
}
],
"description": "Get siteinfo interface",
"description": "update site info interface",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo interface",
"summary": "update site info interface",
"parameters": [
{
"description": "general",
@ -1427,6 +1443,11 @@ const docTemplate = `{
},
"/answer/api/v1/language/options": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Get language options",
"produces": [
"application/json"
@ -3381,52 +3402,6 @@ const docTemplate = `{
}
}
},
"/answer/api/v1/user/interface": {
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "UserUpdateInterface update user interface config",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User"
],
"summary": "UserUpdateInterface update user interface config",
"parameters": [
{
"type": "string",
"description": "access-token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "UpdateInfoRequest",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/schema.UpdateUserInterfaceRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.RespBody"
}
}
}
}
},
"/answer/api/v1/user/login/email": {
"post": {
"description": "UserEmailLogin",
@ -4858,10 +4833,6 @@ const docTemplate = `{
"description": "is admin",
"type": "boolean"
},
"language": {
"description": "language",
"type": "string"
},
"last_login_date": {
"description": "last login date",
"type": "integer"
@ -4958,10 +4929,6 @@ const docTemplate = `{
"description": "is admin",
"type": "boolean"
},
"language": {
"description": "language",
"type": "string"
},
"last_login_date": {
"description": "last login date",
"type": "integer"
@ -5370,7 +5337,8 @@ const docTemplate = `{
"type": "object",
"required": [
"language",
"theme"
"theme",
"time_zone"
],
"properties": {
"language": {
@ -5384,6 +5352,10 @@ const docTemplate = `{
"theme": {
"type": "string",
"maxLength": 128
},
"time_zone": {
"type": "string",
"maxLength": 128
}
}
},
@ -5391,7 +5363,8 @@ const docTemplate = `{
"type": "object",
"required": [
"language",
"theme"
"theme",
"time_zone"
],
"properties": {
"language": {
@ -5405,6 +5378,10 @@ const docTemplate = `{
"theme": {
"type": "string",
"maxLength": 128
},
"time_zone": {
"type": "string",
"maxLength": 128
}
}
},
@ -5617,19 +5594,6 @@ const docTemplate = `{
}
}
},
"schema.UpdateUserInterfaceRequest": {
"type": "object",
"required": [
"language"
],
"properties": {
"language": {
"description": "language",
"type": "string",
"maxLength": 100
}
}
},
"schema.UpdateUserStatusReq": {
"type": "object",
"required": [

View File

@ -50,12 +50,6 @@
"description": "answer id or question title",
"name": "query",
"in": "query"
},
{
"type": "string",
"description": "question id",
"name": "question_id",
"in": "query"
}
],
"responses": {
@ -107,8 +101,41 @@
}
}
},
"/answer/admin/api/dashboard": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "DashboardInfo",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "DashboardInfo",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.RespBody"
}
}
}
}
},
"/answer/admin/api/language/options": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Get language options",
"produces": [
"application/json"
@ -470,14 +497,14 @@
"ApiKeyAuth": []
}
],
"description": "Get siteinfo general",
"description": "get site general information",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo general",
"summary": "get site general information",
"responses": {
"200": {
"description": "OK",
@ -505,14 +532,14 @@
"ApiKeyAuth": []
}
],
"description": "Get siteinfo interface",
"description": "update site general information",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo interface",
"summary": "update site general information",
"parameters": [
{
"description": "general",
@ -541,25 +568,14 @@
"ApiKeyAuth": []
}
],
"description": "Get siteinfo interface",
"description": "get site interface",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo interface",
"parameters": [
{
"description": "general",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/schema.AddCommentReq"
}
}
],
"summary": "get site interface",
"responses": {
"200": {
"description": "OK",
@ -587,14 +603,14 @@
"ApiKeyAuth": []
}
],
"description": "Get siteinfo interface",
"description": "update site info interface",
"produces": [
"application/json"
],
"tags": [
"admin"
],
"summary": "Get siteinfo interface",
"summary": "update site info interface",
"parameters": [
{
"description": "general",
@ -1415,6 +1431,11 @@
},
"/answer/api/v1/language/options": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Get language options",
"produces": [
"application/json"
@ -3369,52 +3390,6 @@
}
}
},
"/answer/api/v1/user/interface": {
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "UserUpdateInterface update user interface config",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User"
],
"summary": "UserUpdateInterface update user interface config",
"parameters": [
{
"type": "string",
"description": "access-token",
"name": "Authorization",
"in": "header",
"required": true
},
{
"description": "UpdateInfoRequest",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/schema.UpdateUserInterfaceRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.RespBody"
}
}
}
}
},
"/answer/api/v1/user/login/email": {
"post": {
"description": "UserEmailLogin",
@ -4846,10 +4821,6 @@
"description": "is admin",
"type": "boolean"
},
"language": {
"description": "language",
"type": "string"
},
"last_login_date": {
"description": "last login date",
"type": "integer"
@ -4946,10 +4917,6 @@
"description": "is admin",
"type": "boolean"
},
"language": {
"description": "language",
"type": "string"
},
"last_login_date": {
"description": "last login date",
"type": "integer"
@ -5358,7 +5325,8 @@
"type": "object",
"required": [
"language",
"theme"
"theme",
"time_zone"
],
"properties": {
"language": {
@ -5372,6 +5340,10 @@
"theme": {
"type": "string",
"maxLength": 128
},
"time_zone": {
"type": "string",
"maxLength": 128
}
}
},
@ -5379,7 +5351,8 @@
"type": "object",
"required": [
"language",
"theme"
"theme",
"time_zone"
],
"properties": {
"language": {
@ -5393,6 +5366,10 @@
"theme": {
"type": "string",
"maxLength": 128
},
"time_zone": {
"type": "string",
"maxLength": 128
}
}
},
@ -5605,19 +5582,6 @@
}
}
},
"schema.UpdateUserInterfaceRequest": {
"type": "object",
"required": [
"language"
],
"properties": {
"language": {
"description": "language",
"type": "string",
"maxLength": 100
}
}
},
"schema.UpdateUserStatusReq": {
"type": "object",
"required": [

View File

@ -652,9 +652,6 @@ definitions:
is_admin:
description: is admin
type: boolean
language:
description: language
type: string
last_login_date:
description: last login date
type: integer
@ -726,9 +723,6 @@ definitions:
is_admin:
description: is admin
type: boolean
language:
description: language
type: string
last_login_date:
description: last login date
type: integer
@ -1030,9 +1024,13 @@ definitions:
theme:
maxLength: 128
type: string
time_zone:
maxLength: 128
type: string
required:
- language
- theme
- time_zone
type: object
schema.SiteInterfaceResp:
properties:
@ -1045,9 +1043,13 @@ definitions:
theme:
maxLength: 128
type: string
time_zone:
maxLength: 128
type: string
required:
- language
- theme
- time_zone
type: object
schema.TagItem:
properties:
@ -1201,15 +1203,6 @@ definitions:
- synonym_tag_list
- tag_id
type: object
schema.UpdateUserInterfaceRequest:
properties:
language:
description: language
maxLength: 100
type: string
required:
- language
type: object
schema.UpdateUserStatusReq:
properties:
status:
@ -1409,10 +1402,6 @@ paths:
in: query
name: query
type: string
- description: question id
in: query
name: question_id
type: string
produces:
- application/json
responses:
@ -1449,6 +1438,23 @@ paths:
summary: AdminSetAnswerStatus
tags:
- admin
/answer/admin/api/dashboard:
get:
consumes:
- application/json
description: DashboardInfo
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.RespBody'
security:
- ApiKeyAuth: []
summary: DashboardInfo
tags:
- admin
/answer/admin/api/language/options:
get:
description: Get language options
@ -1459,6 +1465,8 @@ paths:
description: OK
schema:
$ref: '#/definitions/handler.RespBody'
security:
- ApiKeyAuth: []
summary: Get language options
tags:
- Lang
@ -1675,7 +1683,7 @@ paths:
- admin
/answer/admin/api/siteinfo/general:
get:
description: Get siteinfo general
description: get site general information
produces:
- application/json
responses:
@ -1690,11 +1698,11 @@ paths:
type: object
security:
- ApiKeyAuth: []
summary: Get siteinfo general
summary: get site general information
tags:
- admin
put:
description: Get siteinfo interface
description: update site general information
parameters:
- description: general
in: body
@ -1711,19 +1719,12 @@ paths:
$ref: '#/definitions/handler.RespBody'
security:
- ApiKeyAuth: []
summary: Get siteinfo interface
summary: update site general information
tags:
- admin
/answer/admin/api/siteinfo/interface:
get:
description: Get siteinfo interface
parameters:
- description: general
in: body
name: data
required: true
schema:
$ref: '#/definitions/schema.AddCommentReq'
description: get site interface
produces:
- application/json
responses:
@ -1738,11 +1739,11 @@ paths:
type: object
security:
- ApiKeyAuth: []
summary: Get siteinfo interface
summary: get site interface
tags:
- admin
put:
description: Get siteinfo interface
description: update site info interface
parameters:
- description: general
in: body
@ -1759,7 +1760,7 @@ paths:
$ref: '#/definitions/handler.RespBody'
security:
- ApiKeyAuth: []
summary: Get siteinfo interface
summary: update site info interface
tags:
- admin
/answer/admin/api/theme/options:
@ -2250,6 +2251,8 @@ paths:
description: OK
schema:
$ref: '#/definitions/handler.RespBody'
security:
- ApiKeyAuth: []
summary: Get language options
tags:
- Lang
@ -3436,35 +3439,6 @@ paths:
summary: UserUpdateInfo update user info
tags:
- User
/answer/api/v1/user/interface:
put:
consumes:
- application/json
description: UserUpdateInterface update user interface config
parameters:
- description: access-token
in: header
name: Authorization
required: true
type: string
- description: UpdateInfoRequest
in: body
name: data
required: true
schema:
$ref: '#/definitions/schema.UpdateUserInterfaceRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.RespBody'
security:
- ApiKeyAuth: []
summary: UserUpdateInterface update user interface config
tags:
- User
/answer/api/v1/user/login/email:
post:
consumes:

View File

@ -39,7 +39,6 @@ func (sc *SiteInfoController) GetGeneral(ctx *gin.Context) {
// @Produce json
// @Success 200 {object} handler.RespBody{data=schema.SiteInterfaceResp}
// @Router /answer/admin/api/siteinfo/interface [get]
// @Param data body schema.AddCommentReq true "general"
func (sc *SiteInfoController) GetInterface(ctx *gin.Context) {
resp, err := sc.siteInfoService.GetSiteInterface(ctx)
handler.HandleResponse(ctx, err, resp)