From 1063b0a2c340c19caaf6ea4dc86dbce501f9efc2 Mon Sep 17 00:00:00 2001 From: Patrick Schork Date: Fri, 26 Apr 2024 14:05:19 -0700 Subject: [PATCH] Update swagger docs Lint --- disperser/dataapi/docs/docs.go | 22 +++++++++++++++++++++- disperser/dataapi/docs/swagger.json | 22 +++++++++++++++++++++- disperser/dataapi/docs/swagger.yaml | 15 ++++++++++++++- disperser/dataapi/metrics.go | 1 + disperser/dataapi/server.go | 2 +- disperser/dataapi/server_test.go | 1 + 6 files changed, 59 insertions(+), 4 deletions(-) diff --git a/disperser/dataapi/docs/docs.go b/disperser/dataapi/docs/docs.go index c1878a8a1d..a924e415a0 100644 --- a/disperser/dataapi/docs/docs.go +++ b/disperser/dataapi/docs/docs.go @@ -492,7 +492,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/dataapi.ServiceAvailabilityResponse" + "$ref": "#/definitions/dataapi.OperatorPortCheckResponse" } }, "400": { @@ -720,6 +720,26 @@ const docTemplate = `{ } } }, + "dataapi.OperatorPortCheckResponse": { + "type": "object", + "properties": { + "disperser_online": { + "type": "boolean" + }, + "disperser_socket": { + "type": "string" + }, + "operator_id": { + "type": "string" + }, + "retriever_online": { + "type": "boolean" + }, + "retriever_socket": { + "type": "string" + } + } + }, "dataapi.OperatorsNonsigningPercentage": { "type": "object", "properties": { diff --git a/disperser/dataapi/docs/swagger.json b/disperser/dataapi/docs/swagger.json index 786c4614d6..3add78eab2 100644 --- a/disperser/dataapi/docs/swagger.json +++ b/disperser/dataapi/docs/swagger.json @@ -488,7 +488,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/dataapi.ServiceAvailabilityResponse" + "$ref": "#/definitions/dataapi.OperatorPortCheckResponse" } }, "400": { @@ -716,6 +716,26 @@ } } }, + "dataapi.OperatorPortCheckResponse": { + "type": "object", + "properties": { + "disperser_online": { + "type": "boolean" + }, + "disperser_socket": { + "type": "string" + }, + "operator_id": { + "type": "string" + }, + "retriever_online": { + "type": "boolean" + }, + "retriever_socket": { + "type": "string" + } + } + }, "dataapi.OperatorsNonsigningPercentage": { "type": "object", "properties": { diff --git a/disperser/dataapi/docs/swagger.yaml b/disperser/dataapi/docs/swagger.yaml index a6b906e181..f89e18cb32 100644 --- a/disperser/dataapi/docs/swagger.yaml +++ b/disperser/dataapi/docs/swagger.yaml @@ -138,6 +138,19 @@ definitions: total_unsigned_batches: type: integer type: object + dataapi.OperatorPortCheckResponse: + properties: + disperser_online: + type: boolean + disperser_socket: + type: string + operator_id: + type: string + retriever_online: + type: boolean + retriever_socket: + type: string + type: object dataapi.OperatorsNonsigningPercentage: properties: data: @@ -539,7 +552,7 @@ paths: "200": description: OK schema: - $ref: '#/definitions/dataapi.ServiceAvailabilityResponse' + $ref: '#/definitions/dataapi.OperatorPortCheckResponse' "400": description: 'error: Bad request' schema: diff --git a/disperser/dataapi/metrics.go b/disperser/dataapi/metrics.go index daf6958859..6cf82d5b20 100644 --- a/disperser/dataapi/metrics.go +++ b/disperser/dataapi/metrics.go @@ -167,6 +167,7 @@ func (g *Metrics) UpdateRequestedOperatorMetric(numOperatorsByQuorum map[uint8]i func (g *Metrics) UpdateEjectionGasUsed(gasUsed uint64) { g.EjectionGasUsed.Set(float64(gasUsed)) +} // IncrementNotFoundRequestNum increments the number of not found requests func (g *Metrics) IncrementNotFoundRequestNum(method string) { diff --git a/disperser/dataapi/server.go b/disperser/dataapi/server.go index 6f16b487b3..1fe1fa1432 100644 --- a/disperser/dataapi/server.go +++ b/disperser/dataapi/server.go @@ -676,7 +676,7 @@ func (s *server) FetchDeregisteredOperators(c *gin.Context) { // @Tags OperatorsInfo // @Produce json // @Param operator_id query string true "Operator ID" -// @Success 200 {object} ServiceAvailabilityResponse +// @Success 200 {object} OperatorPortCheckResponse // @Failure 400 {object} ErrorResponse "error: Bad request" // @Failure 404 {object} ErrorResponse "error: Not found" // @Failure 500 {object} ErrorResponse "error: Server error" diff --git a/disperser/dataapi/server_test.go b/disperser/dataapi/server_test.go index e1a49bc249..7082fbda45 100644 --- a/disperser/dataapi/server_test.go +++ b/disperser/dataapi/server_test.go @@ -13,6 +13,7 @@ import ( "net/http" "net/http/httptest" "testing" + "time" "github.com/Layr-Labs/eigenda/core" coremock "github.com/Layr-Labs/eigenda/core/mock"