Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

fix(docs): Fix swagger gen #455

Merged
merged 4 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 55 additions & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const docTemplate = `{
"application/json"
],
"summary": "Try to accept a block proof assignment",
"operationId": "create-assignment",
"parameters": [
{
"description": "assignment request body",
Expand Down Expand Up @@ -61,6 +60,29 @@ const docTemplate = `{
}
}
},
"/signedBlocks": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "Get signed blocks",
"operationId": "get-signed-blocks",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/prover_server.SignedBlock"
}
}
}
}
}
},
"/status": {
"get": {
"consumes": [
Expand Down Expand Up @@ -123,6 +145,12 @@ const docTemplate = `{
"prover_server.ProposeBlockResponse": {
"type": "object",
"properties": {
"maxBlockID": {
"type": "integer"
},
"maxProposedIn": {
"type": "integer"
},
"prover": {
"type": "string"
},
Expand All @@ -134,12 +162,35 @@ const docTemplate = `{
}
}
},
"prover_server.SignedBlock": {
"type": "object",
"properties": {
"blockHash": {
"type": "string"
},
"blockID": {
"type": "integer"
},
"proverAddress": {
"type": "string"
},
"signature": {
"type": "string"
}
}
},
"prover_server.Status": {
"type": "object",
"properties": {
"currentCapacity": {
"type": "integer"
},
"heartBeatSignature": {
"type": "array",
"items": {
"type": "integer"
}
},
"maxExpiry": {
"type": "integer"
},
Expand All @@ -151,6 +202,9 @@ const docTemplate = `{
},
"minSgxTierFee": {
"type": "integer"
},
"prover": {
"type": "string"
}
}
}
Expand Down
56 changes: 55 additions & 1 deletion docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"application/json"
],
"summary": "Try to accept a block proof assignment",
"operationId": "create-assignment",
"parameters": [
{
"description": "assignment request body",
Expand Down Expand Up @@ -52,6 +51,29 @@
}
}
},
"/signedBlocks": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "Get signed blocks",
"operationId": "get-signed-blocks",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/prover_server.SignedBlock"
}
}
}
}
}
},
"/status": {
"get": {
"consumes": [
Expand Down Expand Up @@ -114,6 +136,12 @@
"prover_server.ProposeBlockResponse": {
"type": "object",
"properties": {
"maxBlockID": {
"type": "integer"
},
"maxProposedIn": {
"type": "integer"
},
"prover": {
"type": "string"
},
Expand All @@ -125,12 +153,35 @@
}
}
},
"prover_server.SignedBlock": {
"type": "object",
"properties": {
"blockHash": {
"type": "string"
},
"blockID": {
"type": "integer"
},
"proverAddress": {
"type": "string"
},
"signature": {
"type": "string"
}
}
},
"prover_server.Status": {
"type": "object",
"properties": {
"currentCapacity": {
"type": "integer"
},
"heartBeatSignature": {
"type": "array",
"items": {
"type": "integer"
}
},
"maxExpiry": {
"type": "integer"
},
Expand All @@ -142,6 +193,9 @@
},
"minSgxTierFee": {
"type": "integer"
},
"prover": {
"type": "string"
}
}
}
Expand Down
37 changes: 36 additions & 1 deletion docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,36 @@ definitions:
type: object
prover_server.ProposeBlockResponse:
properties:
maxBlockID:
type: integer
maxProposedIn:
type: integer
prover:
type: string
signedPayload:
items:
type: integer
type: array
type: object
prover_server.SignedBlock:
properties:
blockHash:
type: string
blockID:
type: integer
proverAddress:
type: string
signature:
type: string
type: object
prover_server.Status:
properties:
currentCapacity:
type: integer
heartBeatSignature:
items:
type: integer
type: array
maxExpiry:
type: integer
minOptimisticTierFee:
Expand All @@ -44,6 +63,8 @@ definitions:
type: integer
minSgxTierFee:
type: integer
prover:
type: string
type: object
info:
contact:
Expand All @@ -61,7 +82,6 @@ paths:
post:
consumes:
- application/json
operationId: create-assignment
parameters:
- description: assignment request body
in: body
Expand All @@ -81,6 +101,21 @@ paths:
schema:
type: string
summary: Try to accept a block proof assignment
/signedBlocks:
get:
consumes:
- application/json
operationId: get-signed-blocks
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/prover_server.SignedBlock'
type: array
summary: Get signed blocks
/status:
get:
consumes:
Expand Down
3 changes: 2 additions & 1 deletion prover/server/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ func (srv *ProverServer) CreateAssignment(c echo.Context) error {
})
}

// SignedBlock represents a signed block.
type SignedBlock struct {
BlockID uint64 `json:"blockID"`
BlockHash string `json:"blockHash"`
Expand All @@ -231,7 +232,7 @@ type SignedBlock struct {
// @ID get-signed-blocks
// @Accept json
// @Produce json
// @Success 200 {object} []SignedBlocks
// @Success 200 {object} []SignedBlock
// @Router /signedBlocks [get]
func (srv *ProverServer) GetSignedBlocks(c echo.Context) error {
latestBlock, err := srv.rpc.L2.BlockByNumber(c.Request().Context(), nil)
Expand Down