Updated /admin/v1 endpoint with modified and new scema types and endpoints

This commit is contained in:
NagyZoltanPeter 2025-04-25 03:08:20 +02:00
parent 157e3d041e
commit 7fcc61a956
No known key found for this signature in database
GPG Key ID: 16EADB9673B65368
11 changed files with 292 additions and 40 deletions

View File

@ -0,0 +1,30 @@
get:
summary: Get connected peers info
description: Retrieve information about connected peers.
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

@ -13,8 +13,11 @@ get:
type: array
items:
$ref: "./schemas/apitypes.yaml#/WakuPeer"
'5XX':
description: Unexpected error.
'500':
description: Internal server error.
content:
text/plain:
type: string
post:
summary: Adds new peer(s) to connect with
description: Adds new peer(s) to connect with.
@ -33,5 +36,11 @@ post:
description: Ok
'400':
description: Cannot connect to one or more peers.
content:
text/plain:
type: string
'5XX':
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 by service
description: Returns information about relay peers in node's direct mesh, grouped by shards.
operationId: getMeshPeers
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 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: 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 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:
$ref: "./debugapi_version.yaml"
/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:
$ref: "./adminapi_filter.yaml"
/debug/v1/info:

View File

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