Merge pull request #19 from waku-org/chore-update-admin-endpoint

Updated /admin/v1 endpoint with modified and new scema types and endpoints
This commit is contained in:
NagyZoltanPeter 2025-04-25 15:08:09 +02:00 committed by GitHub
commit 7d4b74c971
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 295 additions and 43 deletions

View File

@ -0,0 +1,30 @@
get:
summary: Get peer info about a single peer
description: Retrieve information about a single peer.
operationId: getPeerInfo
tags:
- admin
parameters:
- in: path
name: peerId
required: true
schema:
type: string
description: ID of the peer to retrieve information for
responses:
'200':
description: Information about a Waku v2 node.
content:
application/json:
schema:
$ref: "./schemas/apitypes.yaml#/WakuPeer"
'400':
description: Invalid argument.
content:
text/plain:
type: string
'500':
description: Internal server error.
content:
text/plain:
type: string

View File

@ -1,20 +1,23 @@
get: get:
summary: Get connected peers info summary: Get peer info about all peers
description: Retrieve information about connected peers. description: Retrieve information about all peers.
operationId: getPeerInfo operationId: getPeerInfo
tags: tags:
- admin - admin
responses: responses:
'200': '200':
description: Information about a Waku v2 node. description: List of peer info about all peers in peer storage of the node.
content: content:
application/json: application/json:
schema: schema:
type: array type: array
items: items:
$ref: "./schemas/apitypes.yaml#/WakuPeer" $ref: "./schemas/apitypes.yaml#/WakuPeer"
'5XX': '500':
description: Unexpected error. description: Internal server error.
content:
text/plain:
type: string
post: post:
summary: Adds new peer(s) to connect with summary: Adds new peer(s) to connect with
description: Adds new peer(s) to connect with. description: Adds new peer(s) to connect with.
@ -33,5 +36,11 @@ post:
description: Ok description: Ok
'400': '400':
description: Cannot connect to one or more peers. description: Cannot connect to one or more peers.
content:
text/plain:
type: string
'5XX': '5XX':
description: Unexpected error. description: Unexpected error.
content:
text/plain:
type: string

View File

@ -0,0 +1,20 @@
get:
tags:
- admin
summary: Get peers by service
description: Returns information about connected peers
operationId: getConnectedPeers
responses:
'200':
description: Successful service peers response
content:
application/json:
schema:
type: array
items:
$ref: "./schemas/apitypes.yaml#/WakuPeer"
'500':
description: Internal server error.
content:
text/plain:
type: string

View File

@ -0,0 +1,33 @@
get:
tags:
- admin
summary: Get peers by service
description: Returns information about connected peers for a specific shard.
operationId: getConnectedPeersByShard
parameters:
- in: path
name: shardId
required: true
schema:
type: integer
format: uint16
description: ID of the shard to retrieve information for
responses:
'200':
description: Successful service peers response
content:
application/json:
schema:
type: array
items:
$ref: "./schemas/apitypes.yaml#/WakuPeer"
'400':
description: Invalid argument.
content:
text/plain:
type: string
'500':
description: Internal server error.
content:
text/plain:
type: string

View File

@ -0,0 +1,20 @@
get:
tags:
- admin
summary: Get peers of mesh bx subscribed shards
description: Returns information about relay peers in node's direct mesh, grouped by shards.
operationId: getMeshPeers
responses:
'200':
description: List of mesh peers grouped by shard
content:
application/json:
schema:
type: array
items:
$ref: "./schemas/apitypes.yaml#/PeersOfShard"
'500':
description: Internal server error.
content:
text/plain:
type: string

View File

@ -0,0 +1,31 @@
get:
tags:
- admin
summary: Get mesh peers by shard
description: Returns information about relay peers in node's direct mesh for a specific shard.
operationId: getMeshPeersByShard
parameters:
- in: path
name: shardId
required: true
schema:
type: integer
format: uint16
description: ID of the shard to retrieve information for
responses:
'200':
description: List of peers in the mesh of the shard in question
content:
application/json:
schema:
$ref: "./schemas/apitypes.yaml#/PeersOfShard"
'400':
description: Invalid argument.
content:
text/plain:
type: string
'500':
description: Internal server error.
content:
text/plain:
type: string

View File

@ -0,0 +1,20 @@
get:
tags:
- admin
summary: Get peers by service
description: Returns information about relay peers in node's gossip network, grouped by shards.
operationId: getRelayPeers
responses:
'200':
description: Successful service peers response
content:
application/json:
schema:
type: array
items:
$ref: "./schemas/apitypes.yaml#/PeersOfShard"
'500':
description: Internal server error.
content:
text/plain:
type: string

View File

@ -0,0 +1,31 @@
get:
tags:
- admin
summary: Get peers by service
description: Returns information about relay peers in node's gossip network for a specific shard.
operationId: getRelayPeersByShard
parameters:
- in: path
name: shardId
required: true
schema:
type: integer
format: uint16
description: ID of the shard to retrieve information for
responses:
'200':
description: Successful service peers response
content:
application/json:
schema:
$ref: "./schemas/apitypes.yaml#/PeersOfShard"
'400':
description: Invalid argument.
content:
text/plain:
type: string
'500':
description: Internal server error.
content:
text/plain:
type: string

View File

@ -0,0 +1,20 @@
get:
tags:
- admin
summary: Get peers by service
description: Returns information about peers offering specific services
operationId: getPeersByService
responses:
'200':
description: Successful service peers response
content:
application/json:
schema:
type: array
items:
$ref: "./schemas/apitypes.yaml#/WakuPeer"
'500':
description: Internal server error.
content:
text/plain:
type: string

View File

@ -36,7 +36,23 @@ paths:
/version: /version:
$ref: "./debugapi_version.yaml" $ref: "./debugapi_version.yaml"
/admin/v1/peers: /admin/v1/peers:
$ref: "./adminapi.yaml" $ref: "./adminapi_peers.yaml"
/admin/v1/peer/{peerId}:
$ref: "./adminapi_peer.yaml"
/admin/v1/peers/service:
$ref: "./adminapi_peers_service.yaml"
/admin/v1/peers/connected:
$ref: "./adminapi_peers_connected.yaml"
/admin/v1/peers/connected/on/{shardId}:
$ref: "./adminapi_peers_connected_on_shard.yaml"
/admin/v1/peers/relay:
$ref: "./adminapi_peers_relay.yaml"
/admin/v1/peers/relay/on/{shardId}:
$ref: "./adminapi_peers_relay_on_shard.yaml"
/admin/v1/peers/mesh:
$ref: "./adminapi_peers_mesh.yaml"
/admin/v1/peers/mesh/on/{shardId}:
$ref: "./adminapi_peers_mesh_on_shard.yaml"
/admin/v1/filter/subscriptions: /admin/v1/filter/subscriptions:
$ref: "./adminapi_filter.yaml" $ref: "./adminapi_filter.yaml"
/debug/v1/info: /debug/v1/info:

View File

@ -3,6 +3,9 @@ WakuPeer:
required: required:
- multiaddr - multiaddr
- protocols - protocols
- shards
- agent
- connected
- origin - origin
properties: properties:
multiaddr: multiaddr:
@ -10,17 +13,37 @@ WakuPeer:
protocols: protocols:
type: array type: array
items: items:
type: object type: string
required: shards:
- protocol type: array
- connected items:
properties: type: integer
protocol: format: int32
type: string connected:
connected: type: string
type: boolean enum:
- "NotConnected"
- "CannotConnect"
- "CanConnect"
- "Connected"
agent:
type: string
origin: origin:
type: string type: string
score:
type: number
format: double
PeersOfShard:
type: object
properties:
shard:
type: integer
format: int32
peers:
type: array
items:
$ref: "#/WakuPeer"
WakuInfo: WakuInfo:
type: object type: object
@ -42,7 +65,7 @@ ContentTopic:
FilterGetMessagesResponse: FilterGetMessagesResponse:
type: array type: array
items: items:
$ref: '#/WakuMessage' $ref: "#/WakuMessage"
FilterSubscribeRequest: FilterSubscribeRequest:
type: object type: object
@ -52,13 +75,13 @@ FilterSubscribeRequest:
contentFilters: contentFilters:
type: array type: array
items: items:
$ref: '#/ContentTopic' $ref: "#/ContentTopic"
pubsubTopic: pubsubTopic:
$ref: "#/PubsubTopic" $ref: "#/PubsubTopic"
required: required:
- requestId - requestId
- contentFilters - contentFilters
- pubsubTopic - pubsubTopic
FilterUnsubscribeRequest: FilterUnsubscribeRequest:
type: object type: object
@ -68,12 +91,12 @@ FilterUnsubscribeRequest:
contentFilters: contentFilters:
type: array type: array
items: items:
$ref: '#/ContentTopic' $ref: "#/ContentTopic"
pubsubTopic: pubsubTopic:
$ref: "#/PubsubTopic" $ref: "#/PubsubTopic"
required: required:
- requestId - requestId
- contentFilters - contentFilters
FilterUnsubscribeAllRequest: FilterUnsubscribeAllRequest:
type: object type: object
@ -81,7 +104,7 @@ FilterUnsubscribeAllRequest:
requestId: requestId:
type: string type: string
required: required:
- requestId - requestId
FilterSubscriptionResponse: FilterSubscriptionResponse:
type: object type: object
@ -91,7 +114,7 @@ FilterSubscriptionResponse:
statusDesc: statusDesc:
type: string type: string
required: required:
- requestId - requestId
WakuMessage: WakuMessage:
type: object type: object
@ -100,7 +123,7 @@ WakuMessage:
type: string type: string
format: byte format: byte
contentTopic: contentTopic:
$ref: '#/ContentTopic' $ref: "#/ContentTopic"
version: version:
type: integer type: integer
format: int32 format: int32
@ -115,9 +138,9 @@ WakuMessage:
type: string type: string
format: byte format: byte
required: required:
- payload - payload
- contentTopic - contentTopic
- timestamp - timestamp
WakuMessageKeyValue: WakuMessageKeyValue:
type: object type: object
@ -125,7 +148,7 @@ WakuMessageKeyValue:
message_hash: message_hash:
type: string type: string
message: message:
$ref: '#/components/schemas/WakuMessage' $ref: "#/components/schemas/WakuMessage"
required: required:
- message_hash - message_hash
- message - message
@ -143,7 +166,7 @@ StoreQueryResponse:
messages: messages:
type: array type: array
items: items:
$ref: '#/components/schemas/WakuMessageKeyValue' $ref: "#/components/schemas/WakuMessageKeyValue"
paginationCursor: paginationCursor:
type: string type: string
required: required:
@ -156,22 +179,21 @@ PushRequest:
type: object type: object
properties: properties:
pubsubTopic: pubsubTopic:
$ref: '#/PubsubTopic' $ref: "#/PubsubTopic"
message: message:
$ref: '#/WakuMessage' $ref: "#/WakuMessage"
required: required:
- message - message
PushResponse: PushResponse:
type: object type: object
properties: properties:
statusDesc: statusDesc:
type: string type: string
relayPeerCount: relayPeerCount:
type: integer type: integer
format: uint32 format: uint32
## TODO: Check if it can be tunneled into the one WakuMessage structure ## TODO: Check if it can be tunneled into the one WakuMessage structure
## mainly because of Relay post message request can break in client code ## mainly because of Relay post message request can break in client code
RelayWakuMessage: RelayWakuMessage:
@ -181,7 +203,7 @@ RelayWakuMessage:
type: string type: string
format: byte format: byte
contentTopic: contentTopic:
$ref: '#/ContentTopic' $ref: "#/ContentTopic"
version: version:
type: number type: number
timestamp: timestamp:
@ -197,10 +219,10 @@ RelayWakuMessage:
RelayGetMessagesResponse: RelayGetMessagesResponse:
type: array type: array
items: items:
$ref: '#/RelayWakuMessage' $ref: "#/RelayWakuMessage"
RelayPostMessagesRequest: RelayPostMessagesRequest:
$ref: '#/RelayWakuMessage' $ref: "#/RelayWakuMessage"
StoreResponse: StoreResponse:
type: object type: object
@ -208,9 +230,9 @@ StoreResponse:
messages: messages:
type: array type: array
items: items:
$ref: '#/WakuMessage' $ref: "#/WakuMessage"
cursor: cursor:
$ref: '#/HistoryCursor' $ref: "#/HistoryCursor"
error_message: error_message:
type: string type: string
required: required:
@ -268,11 +290,11 @@ HealthReport:
type: object type: object
properties: properties:
nodeHealth: nodeHealth:
$ref: '#/HealthStatus' $ref: "#/HealthStatus"
description: Overall health status of the node description: Overall health status of the node
protocolsHealth: protocolsHealth:
type: array type: array
items: items:
type: object type: object
additionalProperties: additionalProperties:
$ref: '#/HealthStatus' $ref: "#/HealthStatus"