Skip to content

Commit 61cc349

Browse files
committed
fix(1.2.8): 修复生成 swagger doc 后,服务无法启动的问题
1 parent bbe1818 commit 61cc349

File tree

8 files changed

+117
-128
lines changed

8 files changed

+117
-128
lines changed

docs/docs.go

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,49 @@ var doc = `{
12321232
}
12331233
}
12341234
},
1235+
"/api/cron/exec/{id}": {
1236+
"patch": {
1237+
"security": [
1238+
{
1239+
"LoginToken": []
1240+
}
1241+
],
1242+
"description": "手动执行单条任务",
1243+
"consumes": [
1244+
"application/json"
1245+
],
1246+
"produces": [
1247+
"application/json"
1248+
],
1249+
"tags": [
1250+
"API.cron"
1251+
],
1252+
"summary": "手动执行单条任务",
1253+
"parameters": [
1254+
{
1255+
"type": "string",
1256+
"description": "hashId",
1257+
"name": "id",
1258+
"in": "path",
1259+
"required": true
1260+
}
1261+
],
1262+
"responses": {
1263+
"200": {
1264+
"description": "OK",
1265+
"schema": {
1266+
"$ref": "#/definitions/cron.detailResponse"
1267+
}
1268+
},
1269+
"400": {
1270+
"description": "Bad Request",
1271+
"schema": {
1272+
"$ref": "#/definitions/code.Failure"
1273+
}
1274+
}
1275+
}
1276+
}
1277+
},
12351278
"/api/cron/used": {
12361279
"patch": {
12371280
"security": [
@@ -1457,47 +1500,6 @@ var doc = `{
14571500
}
14581501
}
14591502
}
1460-
},
1461-
"patch": {
1462-
"security": [
1463-
{
1464-
"LoginToken": []
1465-
}
1466-
],
1467-
"description": "手动执行单条任务",
1468-
"consumes": [
1469-
"application/json"
1470-
],
1471-
"produces": [
1472-
"application/json"
1473-
],
1474-
"tags": [
1475-
"API.cron"
1476-
],
1477-
"summary": "手动执行单条任务",
1478-
"parameters": [
1479-
{
1480-
"type": "string",
1481-
"description": "hashId",
1482-
"name": "id",
1483-
"in": "path",
1484-
"required": true
1485-
}
1486-
],
1487-
"responses": {
1488-
"200": {
1489-
"description": "OK",
1490-
"schema": {
1491-
"$ref": "#/definitions/cron.detailResponse"
1492-
}
1493-
},
1494-
"400": {
1495-
"description": "Bad Request",
1496-
"schema": {
1497-
"$ref": "#/definitions/code.Failure"
1498-
}
1499-
}
1500-
}
15011503
}
15021504
},
15031505
"/api/login": {

docs/swagger.json

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,6 +1216,49 @@
12161216
}
12171217
}
12181218
},
1219+
"/api/cron/exec/{id}": {
1220+
"patch": {
1221+
"security": [
1222+
{
1223+
"LoginToken": []
1224+
}
1225+
],
1226+
"description": "手动执行单条任务",
1227+
"consumes": [
1228+
"application/json"
1229+
],
1230+
"produces": [
1231+
"application/json"
1232+
],
1233+
"tags": [
1234+
"API.cron"
1235+
],
1236+
"summary": "手动执行单条任务",
1237+
"parameters": [
1238+
{
1239+
"type": "string",
1240+
"description": "hashId",
1241+
"name": "id",
1242+
"in": "path",
1243+
"required": true
1244+
}
1245+
],
1246+
"responses": {
1247+
"200": {
1248+
"description": "OK",
1249+
"schema": {
1250+
"$ref": "#/definitions/cron.detailResponse"
1251+
}
1252+
},
1253+
"400": {
1254+
"description": "Bad Request",
1255+
"schema": {
1256+
"$ref": "#/definitions/code.Failure"
1257+
}
1258+
}
1259+
}
1260+
}
1261+
},
12191262
"/api/cron/used": {
12201263
"patch": {
12211264
"security": [
@@ -1441,47 +1484,6 @@
14411484
}
14421485
}
14431486
}
1444-
},
1445-
"patch": {
1446-
"security": [
1447-
{
1448-
"LoginToken": []
1449-
}
1450-
],
1451-
"description": "手动执行单条任务",
1452-
"consumes": [
1453-
"application/json"
1454-
],
1455-
"produces": [
1456-
"application/json"
1457-
],
1458-
"tags": [
1459-
"API.cron"
1460-
],
1461-
"summary": "手动执行单条任务",
1462-
"parameters": [
1463-
{
1464-
"type": "string",
1465-
"description": "hashId",
1466-
"name": "id",
1467-
"in": "path",
1468-
"required": true
1469-
}
1470-
],
1471-
"responses": {
1472-
"200": {
1473-
"description": "OK",
1474-
"schema": {
1475-
"$ref": "#/definitions/cron.detailResponse"
1476-
}
1477-
},
1478-
"400": {
1479-
"description": "Bad Request",
1480-
"schema": {
1481-
"$ref": "#/definitions/code.Failure"
1482-
}
1483-
}
1484-
}
14851487
}
14861488
},
14871489
"/api/login": {

docs/swagger.yaml

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,32 +1477,6 @@ paths:
14771477
summary: 获取单条任务详情
14781478
tags:
14791479
- API.cron
1480-
patch:
1481-
consumes:
1482-
- application/json
1483-
description: 手动执行单条任务
1484-
parameters:
1485-
- description: hashId
1486-
in: path
1487-
name: id
1488-
required: true
1489-
type: string
1490-
produces:
1491-
- application/json
1492-
responses:
1493-
"200":
1494-
description: OK
1495-
schema:
1496-
$ref: '#/definitions/cron.detailResponse'
1497-
"400":
1498-
description: Bad Request
1499-
schema:
1500-
$ref: '#/definitions/code.Failure'
1501-
security:
1502-
- LoginToken: []
1503-
summary: 手动执行单条任务
1504-
tags:
1505-
- API.cron
15061480
post:
15071481
consumes:
15081482
- application/x-www-form-urlencoded
@@ -1594,6 +1568,33 @@ paths:
15941568
summary: 编辑任务
15951569
tags:
15961570
- API.cron
1571+
/api/cron/exec/{id}:
1572+
patch:
1573+
consumes:
1574+
- application/json
1575+
description: 手动执行单条任务
1576+
parameters:
1577+
- description: hashId
1578+
in: path
1579+
name: id
1580+
required: true
1581+
type: string
1582+
produces:
1583+
- application/json
1584+
responses:
1585+
"200":
1586+
description: OK
1587+
schema:
1588+
$ref: '#/definitions/cron.detailResponse'
1589+
"400":
1590+
description: Bad Request
1591+
schema:
1592+
$ref: '#/definitions/code.Failure'
1593+
security:
1594+
- LoginToken: []
1595+
summary: 手动执行单条任务
1596+
tags:
1597+
- API.cron
15971598
/api/cron/used:
15981599
patch:
15991600
consumes:

internal/api/cron/func_execute.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type executeResponse struct {
2727
// @Param id path string true "hashId"
2828
// @Success 200 {object} detailResponse
2929
// @Failure 400 {object} code.Failure
30-
// @Router /api/cron/{id} [patch]
30+
// @Router /api/cron/exec/{id} [patch]
3131
// @Security LoginToken
3232
func (h *handler) Execute() core.HandlerFunc {
3333
return func(ctx core.Context) {

internal/api/cron/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type Handler interface {
4444

4545
// Execute 手动执行任务
4646
// @Tags API.cron
47-
// @Router /api/cron/{id} [patch]
47+
// @Router /api/cron/exec/{id} [patch]
4848
Execute() core.HandlerFunc
4949
}
5050

scripts/restart.sh

Lines changed: 0 additions & 16 deletions
This file was deleted.

scripts/swagger.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ chcp 65001
33
echo.
44
echo Regenerating swagger doc
55
echo.
6-
go install github.com/swaggo/swag/cmd/swag@latest
6+
go install github.com/swaggo/swag/cmd/swag@v1.7.4
77
swag init
88
echo.
99
echo Done.

scripts/swagger.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
22
printf "\nRegenerating swagger doc\n\n"
3-
go install github.com/swaggo/swag/cmd/swag@latest
3+
go install github.com/swaggo/swag/cmd/swag@v1.7.4
44
time swag init
55
printf "\nDone.\n\n"

0 commit comments

Comments
 (0)