This repository has been archived by the owner on May 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): host swagger doc by github page (#427)
Co-authored-by: David <[email protected]>
- Loading branch information
1 parent
d33e19b
commit ab4e613
Showing
7 changed files
with
142 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Swagger | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
build: | ||
name: Swagger autogen docs | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.21 | ||
cache: true | ||
|
||
- name: install swag cli | ||
run: go install github.com/swaggo/swag/cmd/swag@latest | ||
|
||
- name: swag init | ||
run: ./scripts/gen_swagger_json.sh | ||
|
||
deploy: | ||
if: ${{ always() }} | ||
needs: build | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
name: github pages deploy swagger docs | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
path: '.' | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
definitions: | ||
server.ProposeBlockResponse: | ||
prover_server.ProposeBlockResponse: | ||
properties: | ||
prover: | ||
type: string | ||
|
@@ -8,26 +8,29 @@ definitions: | |
type: integer | ||
type: array | ||
type: object | ||
server.Status: | ||
prover_server.Status: | ||
properties: | ||
currentCapacity: | ||
type: integer | ||
maxExpiry: | ||
type: integer | ||
minProofFee: | ||
minOptimisticTierFee: | ||
type: integer | ||
minPseZkevmTierFee: | ||
type: integer | ||
minSgxTierFee: | ||
type: integer | ||
type: object | ||
host: prover-api.test.taiko.xyz | ||
info: | ||
contact: | ||
email: [email protected] | ||
name: API Support | ||
url: https://community.taiko.xyz/ | ||
license: | ||
name: MIT | ||
url: hhttps://github.com/taikoxyz/taiko-client/blob/main/LICENSE.md | ||
url: https://github.com/taikoxyz/taiko-client/blob/main/LICENSE.md | ||
termsOfService: http://swagger.io/terms/ | ||
title: Taiko Prover API | ||
title: Taiko Prover Server API | ||
version: "1.0" | ||
paths: | ||
/assignment: | ||
|
@@ -41,7 +44,7 @@ paths: | |
"200": | ||
description: OK | ||
schema: | ||
$ref: '#/definitions/server.ProposeBlockResponse' | ||
$ref: '#/definitions/prover_server.ProposeBlockResponse' | ||
"422": | ||
description: prover does not have capacity | ||
schema: | ||
|
@@ -58,6 +61,6 @@ paths: | |
"200": | ||
description: OK | ||
schema: | ||
$ref: '#/definitions/server.Status' | ||
$ref: '#/definitions/prover_server.Status' | ||
summary: Get current prover server status | ||
swagger: "2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<html> | ||
<head> | ||
<!-- Load the latest Swagger UI code and style from npm using unpkg.com --> | ||
<script src="https://unpkg.com/[email protected]/swagger-ui-bundle.js"></script> | ||
<link rel="stylesheet" type="text/css" href="https://unpkg.com/[email protected]/swagger-ui.css" /> | ||
<title>Prover Server API</title> | ||
</head> | ||
<body> | ||
<div id="swagger-ui"></div> <!-- Div to hold the UI component --> | ||
<script> | ||
window.onload = function () { | ||
// Begin Swagger UI call region | ||
const ui = SwaggerUIBundle({ | ||
url: "docs/swagger.json", //Location of Open API spec in the repo | ||
dom_id: '#swagger-ui', | ||
deepLinking: true, | ||
presets: [ | ||
SwaggerUIBundle.presets.apis, | ||
SwaggerUIBundle.SwaggerUIStandalonePreset | ||
], | ||
plugins: [ | ||
SwaggerUIBundle.plugins.DownloadUrl | ||
], | ||
}) | ||
window.ui = ui | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,17 @@ import ( | |
"github.com/taikoxyz/taiko-client/pkg/rpc" | ||
) | ||
|
||
// @title Taiko Prover Server API | ||
// @version 1.0 | ||
// @termsOfService http://swagger.io/terms/ | ||
|
||
// @contact.name API Support | ||
// @contact.url https://community.taiko.xyz/ | ||
// @contact.email [email protected] | ||
|
||
// @license.name MIT | ||
// @license.url https://github.com/taikoxyz/taiko-client/blob/main/LICENSE.md | ||
|
||
// CreateAssignmentRequestBody represents a request body when handling assignment creation request. | ||
type CreateAssignmentRequestBody struct { | ||
FeeToken common.Address | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#/bin/sh | ||
|
||
swag init -g prover/server/api.go --parseDependency |