From 9ce7d9654b7dcb21245c6a34dc755c839246c315 Mon Sep 17 00:00:00 2001 From: Roger <50648015+RogerLamTd@users.noreply.github.com> Date: Mon, 22 Jan 2024 19:28:29 -0800 Subject: [PATCH] chore(docs): update swag script && fix comments (#524) --- docs/docs.go | 18 +++++++++--------- docs/swagger.json | 16 ++++++++-------- docs/swagger.yaml | 16 ++++++++-------- prover/server/server.go | 3 +-- scripts/gen_swagger_json.sh | 2 +- 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 5456bfcba..66111b0c5 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -19,7 +19,7 @@ const docTemplate = `{ "name": "MIT", "url": "https://github.com/taikoxyz/taiko-client/blob/main/LICENSE.md" }, - "version": "{{.JsonRPC}}" + "version": "{{.Version}}" }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", @@ -40,7 +40,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/prover_server.CreateAssignmentRequestBody" + "$ref": "#/definitions/server.CreateAssignmentRequestBody" } } ], @@ -48,7 +48,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/prover_server.ProposeBlockResponse" + "$ref": "#/definitions/server.ProposeBlockResponse" } }, "422": { @@ -74,7 +74,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/prover_server.Status" + "$ref": "#/definitions/server.Status" } } } @@ -85,7 +85,7 @@ const docTemplate = `{ "big.Int": { "type": "object" }, - "github_com_taikoxyz_taiko-client_bindings_encoding.TierFee": { + "encoding.TierFee": { "type": "object", "properties": { "fee": { @@ -96,7 +96,7 @@ const docTemplate = `{ } } }, - "prover_server.CreateAssignmentRequestBody": { + "server.CreateAssignmentRequestBody": { "type": "object", "properties": { "expiry": { @@ -108,7 +108,7 @@ const docTemplate = `{ "tierFees": { "type": "array", "items": { - "$ref": "#/definitions/github_com_taikoxyz_taiko-client_bindings_encoding.TierFee" + "$ref": "#/definitions/encoding.TierFee" } }, "txListHash": { @@ -119,7 +119,7 @@ const docTemplate = `{ } } }, - "prover_server.ProposeBlockResponse": { + "server.ProposeBlockResponse": { "type": "object", "properties": { "maxBlockID": { @@ -139,7 +139,7 @@ const docTemplate = `{ } } }, - "prover_server.Status": { + "server.Status": { "type": "object", "properties": { "maxExpiry": { diff --git a/docs/swagger.json b/docs/swagger.json index faa5742ee..ab29fdaa7 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -31,7 +31,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/prover_server.CreateAssignmentRequestBody" + "$ref": "#/definitions/server.CreateAssignmentRequestBody" } } ], @@ -39,7 +39,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/prover_server.ProposeBlockResponse" + "$ref": "#/definitions/server.ProposeBlockResponse" } }, "422": { @@ -65,7 +65,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/prover_server.Status" + "$ref": "#/definitions/server.Status" } } } @@ -76,7 +76,7 @@ "big.Int": { "type": "object" }, - "github_com_taikoxyz_taiko-client_bindings_encoding.TierFee": { + "encoding.TierFee": { "type": "object", "properties": { "fee": { @@ -87,7 +87,7 @@ } } }, - "prover_server.CreateAssignmentRequestBody": { + "server.CreateAssignmentRequestBody": { "type": "object", "properties": { "expiry": { @@ -99,7 +99,7 @@ "tierFees": { "type": "array", "items": { - "$ref": "#/definitions/github_com_taikoxyz_taiko-client_bindings_encoding.TierFee" + "$ref": "#/definitions/encoding.TierFee" } }, "txListHash": { @@ -110,7 +110,7 @@ } } }, - "prover_server.ProposeBlockResponse": { + "server.ProposeBlockResponse": { "type": "object", "properties": { "maxBlockID": { @@ -130,7 +130,7 @@ } } }, - "prover_server.Status": { + "server.Status": { "type": "object", "properties": { "maxExpiry": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 10bffb6f8..0410d75f8 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,14 +1,14 @@ definitions: big.Int: type: object - github_com_taikoxyz_taiko-client_bindings_encoding.TierFee: + encoding.TierFee: properties: fee: $ref: '#/definitions/big.Int' tier: type: integer type: object - prover_server.CreateAssignmentRequestBody: + server.CreateAssignmentRequestBody: properties: expiry: type: integer @@ -16,14 +16,14 @@ definitions: type: string tierFees: items: - $ref: '#/definitions/github_com_taikoxyz_taiko-client_bindings_encoding.TierFee' + $ref: '#/definitions/encoding.TierFee' type: array txListHash: items: type: integer type: array type: object - prover_server.ProposeBlockResponse: + server.ProposeBlockResponse: properties: maxBlockID: type: integer @@ -36,7 +36,7 @@ definitions: type: integer type: array type: object - prover_server.Status: + server.Status: properties: maxExpiry: type: integer @@ -71,14 +71,14 @@ paths: name: body required: true schema: - $ref: '#/definitions/prover_server.CreateAssignmentRequestBody' + $ref: '#/definitions/server.CreateAssignmentRequestBody' produces: - application/json responses: "200": description: OK schema: - $ref: '#/definitions/prover_server.ProposeBlockResponse' + $ref: '#/definitions/server.ProposeBlockResponse' "422": description: prover does not have capacity schema: @@ -95,6 +95,6 @@ paths: "200": description: OK schema: - $ref: '#/definitions/prover_server.Status' + $ref: '#/definitions/server.Status' summary: Get current prover server status swagger: "2.0" diff --git a/prover/server/server.go b/prover/server/server.go index 54e4d250d..6bf3a30e4 100644 --- a/prover/server/server.go +++ b/prover/server/server.go @@ -18,7 +18,7 @@ import ( "github.com/taikoxyz/taiko-client/pkg/rpc" ) -// @title Taiko Prover API +// @title Taiko Prover Server API // @version 1.0 // @termsOfService http://swagger.io/terms/ @@ -29,7 +29,6 @@ import ( // @license.name MIT // @license.url https://github.com/taikoxyz/taiko-client/blob/main/LICENSE.md -// @host prover-api.test.taiko.xyz // ProverServer represents a prover server instance. type ProverServer struct { echo *echo.Echo diff --git a/scripts/gen_swagger_json.sh b/scripts/gen_swagger_json.sh index de531e342..59dce311d 100755 --- a/scripts/gen_swagger_json.sh +++ b/scripts/gen_swagger_json.sh @@ -1,3 +1,3 @@ #/bin/sh -swag init -g prover/server/api.go --parseDependency --parseGoList +swag init -g api.go -d prover/server --pd