core-lightning/doc/schemas/lightning-ping.json
Rusty Russell b327bd30c3 doc: fix all JSON schemas to enforce no additional properties.
Without this, we have hardly any enforcement.  This is why the schema
mistake fixed in the previous patches weren't spotted immediately.

The hard work was done by:

```
$ for f in lightning-*.json; do grep -v '^  "additionalProperties": false,' $f | bagto $f; done
$ for f in lightning-*.json; do sed 's/"properties": {/"additionalProperties": false, "properties": {/' $f | bagto $f; done
$ make fmt-schemas
```

Then checking where 'additionalProperties: true' had been turned to
false (we deliberately use it in some places where there are if
statements in the schema, or occasionally where there can be arbitrary
fields).

[Including doc/rpc-schema-draft.json update by Shahana]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2024-10-30 15:39:12 +10:30

97 lines
2.3 KiB
JSON

{
"$schema": "../rpc-schema-draft.json",
"type": "object",
"rpc": "ping",
"title": "Command to check if a node is up.",
"description": [
"The **ping** command checks if the node with *id* is ready to talk. It currently only works for peers we have a channel with."
],
"request": {
"required": [
"id"
],
"additionalProperties": false,
"properties": {
"id": {
"type": "pubkey",
"description": [
"The pubkey of the node to ping."
]
},
"len": {
"type": "u16",
"description": [
"The length of the ping."
],
"default": "128"
},
"pongbytes": {
"type": "u16",
"description": [
"The length of the reply. A value of 65532 to 65535 means `don't reply`."
],
"default": "128"
}
}
},
"response": {
"required": [
"totlen"
],
"additionalProperties": false,
"properties": {
"totlen": {
"type": "u16",
"description": [
"The answer length of the reply message (including header: 0 means no reply expected)."
]
}
}
},
"errors": [
"On failure, one of the following error codes may be returned:",
"",
"- -32602: Error in given parameters or we're already waiting for a ping response from peer."
],
"author": [
"Vincenzo Palazzo <<vincenzo.palazzo@protonmail.com>> wrote the initial version of this man page,",
"but many others did the hard work of actually implementing this rpc command."
],
"see_also": [
"lightning-connect(7)"
],
"resources": [
"Main web site: <https://github.com/ElementsProject/lightning>"
],
"examples": [
{
"request": {
"id": "example:ping#1",
"method": "ping",
"params": {
"id": "0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518",
"len": 128,
"pongbytes": 128
}
},
"response": {
"totlen": 132
}
},
{
"request": {
"id": "example:ping#2",
"method": "ping",
"params": {
"id": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
"len": 1000,
"pongbytes": 65535
}
},
"response": {
"totlen": 0
}
}
]
}