-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add swagger docs for server api to blobstorage repo
- Loading branch information
1 parent
72d74b1
commit 3415685
Showing
6 changed files
with
266 additions
and
12 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,98 @@ | ||
// Package docs Code generated by swaggo/swag. DO NOT EDIT | ||
package docs | ||
|
||
import "github.com/swaggo/swag" | ||
|
||
const docTemplate = `{ | ||
"schemes": {{ marshal .Schemes }}, | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "{{escape .Description}}", | ||
"title": "{{.Title}}", | ||
"termsOfService": "http://swagger.io/terms/", | ||
"contact": { | ||
"name": "API Support", | ||
"url": "https://community.taiko.xyz/", | ||
"email": "[email protected]" | ||
}, | ||
"license": { | ||
"name": "MIT" | ||
}, | ||
"version": "{{.Version}}" | ||
}, | ||
"host": "{{.Host}}", | ||
"basePath": "{{.BasePath}}", | ||
"paths": { | ||
"/getBlob": { | ||
"get": { | ||
"consumes": [ | ||
"application/json" | ||
], | ||
"produces": [ | ||
"application/json" | ||
], | ||
"summary": "Get blob and KZG commitment", | ||
"operationId": "get-blob", | ||
"parameters": [ | ||
{ | ||
"type": "string", | ||
"description": "blobHash to query", | ||
"name": "blobHash", | ||
"in": "query", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"schema": { | ||
"$ref": "#/definitions/http.getBlobResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"http.blobData": { | ||
"type": "object", | ||
"properties": { | ||
"blob_hash": { | ||
"type": "string" | ||
}, | ||
"kzg_commitment": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"http.getBlobResponse": { | ||
"type": "object", | ||
"properties": { | ||
"data": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/http.blobData" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}` | ||
|
||
// SwaggerInfo holds exported Swagger Info so clients can modify it | ||
var SwaggerInfo = &swag.Spec{ | ||
Version: "1.0", | ||
Host: "blobs.internal.taiko.xyz", | ||
BasePath: "", | ||
Schemes: []string{}, | ||
Title: "Taiko Blobstorage API", | ||
Description: "", | ||
InfoInstanceName: "swagger", | ||
SwaggerTemplate: docTemplate, | ||
LeftDelim: "{{", | ||
RightDelim: "}}", | ||
} | ||
|
||
func init() { | ||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) | ||
} |
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/swagger-ui-dist@3/swagger-ui-bundle.js"></script> | ||
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3/swagger-ui.css"/> | ||
<title>Blobstorage 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: "/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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"title": "Taiko Blobstorage API", | ||
"termsOfService": "http://swagger.io/terms/", | ||
"contact": { | ||
"name": "API Support", | ||
"url": "https://community.taiko.xyz/", | ||
"email": "[email protected]" | ||
}, | ||
"license": { | ||
"name": "MIT" | ||
}, | ||
"version": "1.0" | ||
}, | ||
"host": "blobs.internal.taiko.xyz", | ||
"paths": { | ||
"/getBlob": { | ||
"get": { | ||
"consumes": ["application/json"], | ||
"produces": ["application/json"], | ||
"summary": "Get blob and KZG commitment", | ||
"operationId": "get-blob", | ||
"parameters": [ | ||
{ | ||
"type": "string", | ||
"description": "blobHash to query", | ||
"name": "blobHash", | ||
"in": "query", | ||
"required": true | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "OK", | ||
"schema": { | ||
"$ref": "#/definitions/http.getBlobResponse" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"http.blobData": { | ||
"type": "object", | ||
"properties": { | ||
"blob_hash": { | ||
"type": "string" | ||
}, | ||
"kzg_commitment": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"http.getBlobResponse": { | ||
"type": "object", | ||
"properties": { | ||
"data": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/definitions/http.blobData" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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,47 @@ | ||
definitions: | ||
http.blobData: | ||
properties: | ||
blob_hash: | ||
type: string | ||
kzg_commitment: | ||
type: string | ||
type: object | ||
http.getBlobResponse: | ||
properties: | ||
data: | ||
items: | ||
$ref: "#/definitions/http.blobData" | ||
type: array | ||
type: object | ||
host: blobs.internal.taiko.xyz | ||
info: | ||
contact: | ||
email: [email protected] | ||
name: API Support | ||
url: https://community.taiko.xyz/ | ||
license: | ||
name: MIT | ||
termsOfService: http://swagger.io/terms/ | ||
title: Taiko Blobstorage API | ||
version: "1.0" | ||
paths: | ||
/getBlob: | ||
get: | ||
consumes: | ||
- application/json | ||
operationId: get-blob | ||
parameters: | ||
- description: blobHash to query | ||
in: query | ||
name: blobHash | ||
required: true | ||
type: string | ||
produces: | ||
- application/json | ||
responses: | ||
"200": | ||
description: OK | ||
schema: | ||
$ref: "#/definitions/http.getBlobResponse" | ||
summary: Get blob and KZG commitment | ||
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
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 |
---|---|---|
|
@@ -17,18 +17,19 @@ type ethClient interface { | |
ChainID(ctx context.Context) (*big.Int, error) | ||
} | ||
|
||
// @title Taiko Relayer API | ||
// @version 1.0 | ||
// @termsOfService http://swagger.io/terms/ | ||
// @title Taiko Blobstorage API | ||
// @version 1.0 | ||
// @termsOfService http://swagger.io/terms/ | ||
|
||
// @contact.name API Support | ||
// @contact.url https://community.taiko.xyz/ | ||
// @contact.email [email protected] | ||
// @contact.name API Support | ||
// @contact.url https://community.taiko.xyz/ | ||
// @contact.email [email protected] | ||
|
||
// @license.name MIT | ||
// @license.name MIT | ||
|
||
// @host relayer.katla.taiko.xyz | ||
// Server represents an relayer http server instance. | ||
// @host blobs.internal.taiko.xyz | ||
// | ||
// Server represents an blobstorage http server instance. | ||
type Server struct { | ||
echo *echo.Echo | ||
blobHashRepo blobstorage.BlobHashRepository | ||
|