mirror of
https://github.com/xinliangnote/go-gin-api.git
synced 2024-04-21 12:31:46 +00:00
fix(1.2.8): 修复生成 swagger doc 后,服务无法启动的问题
This commit is contained in:
+43
-41
@@ -1232,6 +1232,49 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/cron/exec/{id}": {
|
||||
"patch": {
|
||||
"security": [
|
||||
{
|
||||
"LoginToken": []
|
||||
}
|
||||
],
|
||||
"description": "手动执行单条任务",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"API.cron"
|
||||
],
|
||||
"summary": "手动执行单条任务",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "hashId",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cron.detailResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/code.Failure"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/cron/used": {
|
||||
"patch": {
|
||||
"security": [
|
||||
@@ -1457,47 +1500,6 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"security": [
|
||||
{
|
||||
"LoginToken": []
|
||||
}
|
||||
],
|
||||
"description": "手动执行单条任务",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"API.cron"
|
||||
],
|
||||
"summary": "手动执行单条任务",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "hashId",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cron.detailResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/code.Failure"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/login": {
|
||||
|
||||
+43
-41
@@ -1216,6 +1216,49 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/cron/exec/{id}": {
|
||||
"patch": {
|
||||
"security": [
|
||||
{
|
||||
"LoginToken": []
|
||||
}
|
||||
],
|
||||
"description": "手动执行单条任务",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"API.cron"
|
||||
],
|
||||
"summary": "手动执行单条任务",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "hashId",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cron.detailResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/code.Failure"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/cron/used": {
|
||||
"patch": {
|
||||
"security": [
|
||||
@@ -1441,47 +1484,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"patch": {
|
||||
"security": [
|
||||
{
|
||||
"LoginToken": []
|
||||
}
|
||||
],
|
||||
"description": "手动执行单条任务",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"API.cron"
|
||||
],
|
||||
"summary": "手动执行单条任务",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "hashId",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/cron.detailResponse"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/code.Failure"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/login": {
|
||||
|
||||
+27
-26
@@ -1477,32 +1477,6 @@ paths:
|
||||
summary: 获取单条任务详情
|
||||
tags:
|
||||
- API.cron
|
||||
patch:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 手动执行单条任务
|
||||
parameters:
|
||||
- description: hashId
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/cron.detailResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/code.Failure'
|
||||
security:
|
||||
- LoginToken: []
|
||||
summary: 手动执行单条任务
|
||||
tags:
|
||||
- API.cron
|
||||
post:
|
||||
consumes:
|
||||
- application/x-www-form-urlencoded
|
||||
@@ -1594,6 +1568,33 @@ paths:
|
||||
summary: 编辑任务
|
||||
tags:
|
||||
- API.cron
|
||||
/api/cron/exec/{id}:
|
||||
patch:
|
||||
consumes:
|
||||
- application/json
|
||||
description: 手动执行单条任务
|
||||
parameters:
|
||||
- description: hashId
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/cron.detailResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/code.Failure'
|
||||
security:
|
||||
- LoginToken: []
|
||||
summary: 手动执行单条任务
|
||||
tags:
|
||||
- API.cron
|
||||
/api/cron/used:
|
||||
patch:
|
||||
consumes:
|
||||
|
||||
@@ -27,7 +27,7 @@ type executeResponse struct {
|
||||
// @Param id path string true "hashId"
|
||||
// @Success 200 {object} detailResponse
|
||||
// @Failure 400 {object} code.Failure
|
||||
// @Router /api/cron/{id} [patch]
|
||||
// @Router /api/cron/exec/{id} [patch]
|
||||
// @Security LoginToken
|
||||
func (h *handler) Execute() core.HandlerFunc {
|
||||
return func(ctx core.Context) {
|
||||
|
||||
@@ -44,7 +44,7 @@ type Handler interface {
|
||||
|
||||
// Execute 手动执行任务
|
||||
// @Tags API.cron
|
||||
// @Router /api/cron/{id} [patch]
|
||||
// @Router /api/cron/exec/{id} [patch]
|
||||
Execute() core.HandlerFunc
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
shellExit()
|
||||
{
|
||||
if [ $1 -eq 1 ]; then
|
||||
printf "\nfailed!!!\n\n"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
printf "\nRestart server port:9999 \n\n"
|
||||
|
||||
lsof -i:9999 | grep LISTEN | awk '{print $2}' | xargs kill -s SIGINT && go run ./main.go -env fat
|
||||
shellExit $?
|
||||
|
||||
printf "\nDone.\n\n"
|
||||
+1
-1
@@ -3,7 +3,7 @@ chcp 65001
|
||||
echo.
|
||||
echo Regenerating swagger doc
|
||||
echo.
|
||||
go install github.com/swaggo/swag/cmd/swag@latest
|
||||
go install github.com/swaggo/swag/cmd/swag@v1.7.4
|
||||
swag init
|
||||
echo.
|
||||
echo Done.
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
printf "\nRegenerating swagger doc\n\n"
|
||||
go install github.com/swaggo/swag/cmd/swag@latest
|
||||
go install github.com/swaggo/swag/cmd/swag@v1.7.4
|
||||
time swag init
|
||||
printf "\nDone.\n\n"
|
||||
Reference in New Issue
Block a user