From 0e1e29eeb068fd66b7fc8390c6113172f4476a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E8=B6=85=E8=B6=8A?= <993921@qq.com> Date: Tue, 5 Mar 2024 20:13:04 +0800 Subject: [PATCH 1/6] feat: auto update swagger --- .github/workflows/coverage.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 43fd7267..51085d32 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -11,6 +11,7 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: actions/commit@v2 - name: Set up Go uses: actions/setup-go@v4 with: From 83238931f7e65a422c72041f008ad1826318f65a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E8=B6=85=E8=B6=8A?= <993921@qq.com> Date: Tue, 5 Mar 2024 20:46:29 +0800 Subject: [PATCH 2/6] swagger update action --- .github/workflows/coverage.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 51085d32..0bd9995b 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -10,8 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/commit@v2 + - uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v4 with: @@ -22,5 +21,15 @@ jobs: run: go install golang.org/x/vuln/cmd/govulncheck@latest && govulncheck ./... - name: Test run: go test -v ./... + - name: Swagger + run: | + go install github.com/swaggo/swag/cmd/swag@latest + swag init -g ./cmd/server/main.go + git config user.name devops + git config suer.email devops@aastar.xyz + git add . + git commit -m "swagger updated" + git push + name: Building And Testing From 4a85101fdf3621f6a08c95d0e1ab0a468e6f946b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E8=B6=85=E8=B6=8A?= <993921@qq.com> Date: Tue, 5 Mar 2024 20:49:40 +0800 Subject: [PATCH 3/6] swagger update action --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 0bd9995b..00e3ec15 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -27,7 +27,7 @@ jobs: swag init -g ./cmd/server/main.go git config user.name devops git config suer.email devops@aastar.xyz - git add . + git add ./docs git commit -m "swagger updated" git push From 45087d9d39752053a0c3e316548b1d5c83910a12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E8=B6=85=E8=B6=8A?= <993921@qq.com> Date: Tue, 5 Mar 2024 20:51:17 +0800 Subject: [PATCH 4/6] swagger update action --- docs/swagger.json | 135 ---------------------------------------------- docs/swagger.yaml | 81 ---------------------------- 2 files changed, 216 deletions(-) delete mode 100644 docs/swagger.json delete mode 100644 docs/swagger.yaml diff --git a/docs/swagger.json b/docs/swagger.json deleted file mode 100644 index fb2d35ee..00000000 --- a/docs/swagger.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "contact": { - "name": "AAStar Support", - "url": "https://aastar.xyz" - } - }, - "paths": { - "/api/auth": { - "post": { - "description": "Get AccessToken By ApiKey", - "consumes": [ - "application/json" - ], - "tags": [ - "Auth" - ], - "parameters": [ - { - "description": "AccessToken Model", - "name": "credential", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.ClientCredential" - } - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/api/healthz": { - "get": { - "description": "Get Healthz", - "tags": [ - "Healthz" - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/api/v1/get-support-entrypoint": { - "get": { - "security": [ - { - "JWT": [] - } - ], - "description": "get the support entrypoint", - "consumes": [ - "application/json" - ], - "tags": [ - "Sponsor" - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/api/v1/get-support-strategy": { - "get": { - "security": [ - { - "JWT": [] - } - ], - "description": "get the support strategy", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "Sponsor" - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, - "/api/v1/try-pay-user-operation": { - "post": { - "security": [ - { - "JWT": [] - } - ], - "description": "sponsor the userOp", - "consumes": [ - "application/json" - ], - "tags": [ - "Sponsor" - ], - "responses": { - "200": { - "description": "OK" - } - } - } - } - }, - "definitions": { - "models.ClientCredential": { - "type": "object", - "properties": { - "apiKey": { - "type": "string" - } - } - } - }, - "securityDefinitions": { - "JWT": { - "description": "Type 'Bearer \\\u003cTOKEN\\\u003e' to correctly set the AccessToken", - "type": "apiKey", - "name": "Authorization", - "in": "header" - } - } -} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml deleted file mode 100644 index 783b7916..00000000 --- a/docs/swagger.yaml +++ /dev/null @@ -1,81 +0,0 @@ -definitions: - models.ClientCredential: - properties: - apiKey: - type: string - type: object -info: - contact: - name: AAStar Support - url: https://aastar.xyz -paths: - /api/auth: - post: - consumes: - - application/json - description: Get AccessToken By ApiKey - parameters: - - description: AccessToken Model - in: body - name: credential - required: true - schema: - $ref: '#/definitions/models.ClientCredential' - responses: - "200": - description: OK - tags: - - Auth - /api/healthz: - get: - description: Get Healthz - responses: - "200": - description: OK - tags: - - Healthz - /api/v1/get-support-entrypoint: - get: - consumes: - - application/json - description: get the support entrypoint - responses: - "200": - description: OK - security: - - JWT: [] - tags: - - Sponsor - /api/v1/get-support-strategy: - get: - consumes: - - application/json - description: get the support strategy - produces: - - application/json - responses: - "200": - description: OK - security: - - JWT: [] - tags: - - Sponsor - /api/v1/try-pay-user-operation: - post: - consumes: - - application/json - description: sponsor the userOp - responses: - "200": - description: OK - security: - - JWT: [] - tags: - - Sponsor -securityDefinitions: - JWT: - description: Type 'Bearer \' to correctly set the AccessToken - in: header - name: Authorization - type: apiKey -swagger: "2.0" From 6af2dc58cd7b10d1c62a7b71c304f0a79aa69173 Mon Sep 17 00:00:00 2001 From: devops <993921@qq.com> Date: Tue, 5 Mar 2024 21:05:45 +0800 Subject: [PATCH 5/6] swagger updated --- .github/scripts/auto-swagger.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/scripts/auto-swagger.sh diff --git a/.github/scripts/auto-swagger.sh b/.github/scripts/auto-swagger.sh new file mode 100644 index 00000000..3a36349a --- /dev/null +++ b/.github/scripts/auto-swagger.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +{ +go install github.com/swaggo/swag/cmd/swag@latest +swag init -g ./cmd/server/main.go +git config user.name devops +git config suer.email devops@aastar.xyz +git add . +git commit -m "swagger updated" +git push +} || { +set -e +} From 0d7f8f0ed4cece48408947be3b4cf52487b5f821 Mon Sep 17 00:00:00 2001 From: devops <993921@qq.com> Date: Tue, 5 Mar 2024 21:06:27 +0800 Subject: [PATCH 6/6] swagger update action --- .github/workflows/coverage.yml | 10 +-- docs/swagger.json | 135 +++++++++++++++++++++++++++++++++ docs/swagger.yaml | 81 ++++++++++++++++++++ 3 files changed, 218 insertions(+), 8 deletions(-) create mode 100644 docs/swagger.json create mode 100644 docs/swagger.yaml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 00e3ec15..7ceab15a 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -22,14 +22,8 @@ jobs: - name: Test run: go test -v ./... - name: Swagger - run: | - go install github.com/swaggo/swag/cmd/swag@latest - swag init -g ./cmd/server/main.go - git config user.name devops - git config suer.email devops@aastar.xyz - git add ./docs - git commit -m "swagger updated" - git push + run: chmod +x ./.github/scripts/auto-swagger.sh && ./.github/scripts/auto-swagger.sh + name: Building And Testing diff --git a/docs/swagger.json b/docs/swagger.json new file mode 100644 index 00000000..fb2d35ee --- /dev/null +++ b/docs/swagger.json @@ -0,0 +1,135 @@ +{ + "swagger": "2.0", + "info": { + "contact": { + "name": "AAStar Support", + "url": "https://aastar.xyz" + } + }, + "paths": { + "/api/auth": { + "post": { + "description": "Get AccessToken By ApiKey", + "consumes": [ + "application/json" + ], + "tags": [ + "Auth" + ], + "parameters": [ + { + "description": "AccessToken Model", + "name": "credential", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ClientCredential" + } + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/healthz": { + "get": { + "description": "Get Healthz", + "tags": [ + "Healthz" + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/get-support-entrypoint": { + "get": { + "security": [ + { + "JWT": [] + } + ], + "description": "get the support entrypoint", + "consumes": [ + "application/json" + ], + "tags": [ + "Sponsor" + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/get-support-strategy": { + "get": { + "security": [ + { + "JWT": [] + } + ], + "description": "get the support strategy", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "Sponsor" + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, + "/api/v1/try-pay-user-operation": { + "post": { + "security": [ + { + "JWT": [] + } + ], + "description": "sponsor the userOp", + "consumes": [ + "application/json" + ], + "tags": [ + "Sponsor" + ], + "responses": { + "200": { + "description": "OK" + } + } + } + } + }, + "definitions": { + "models.ClientCredential": { + "type": "object", + "properties": { + "apiKey": { + "type": "string" + } + } + } + }, + "securityDefinitions": { + "JWT": { + "description": "Type 'Bearer \\\u003cTOKEN\\\u003e' to correctly set the AccessToken", + "type": "apiKey", + "name": "Authorization", + "in": "header" + } + } +} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml new file mode 100644 index 00000000..783b7916 --- /dev/null +++ b/docs/swagger.yaml @@ -0,0 +1,81 @@ +definitions: + models.ClientCredential: + properties: + apiKey: + type: string + type: object +info: + contact: + name: AAStar Support + url: https://aastar.xyz +paths: + /api/auth: + post: + consumes: + - application/json + description: Get AccessToken By ApiKey + parameters: + - description: AccessToken Model + in: body + name: credential + required: true + schema: + $ref: '#/definitions/models.ClientCredential' + responses: + "200": + description: OK + tags: + - Auth + /api/healthz: + get: + description: Get Healthz + responses: + "200": + description: OK + tags: + - Healthz + /api/v1/get-support-entrypoint: + get: + consumes: + - application/json + description: get the support entrypoint + responses: + "200": + description: OK + security: + - JWT: [] + tags: + - Sponsor + /api/v1/get-support-strategy: + get: + consumes: + - application/json + description: get the support strategy + produces: + - application/json + responses: + "200": + description: OK + security: + - JWT: [] + tags: + - Sponsor + /api/v1/try-pay-user-operation: + post: + consumes: + - application/json + description: sponsor the userOp + responses: + "200": + description: OK + security: + - JWT: [] + tags: + - Sponsor +securityDefinitions: + JWT: + description: Type 'Bearer \' to correctly set the AccessToken + in: header + name: Authorization + type: apiKey +swagger: "2.0"