core-lightning/doc/schemas/lightning-notifications.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

96 lines
2.8 KiB
JSON

{
"$schema": "../rpc-schema-draft.json",
"type": "object",
"rpc": "notifications",
"title": "Command to set up notifications.",
"description": [
"The **notifications** the RPC command enabled notifications for this JSON-RPC connection. By default (and for backwards-compatibility) notifications are disabled.",
"",
"Various commands, especially complex and slow ones, offer notifications which indicate their progress."
],
"request": {
"required": [
"enable"
],
"additionalProperties": false,
"properties": {
"enable": {
"type": "boolean",
"description": [
"Whether to enable or disable notifications."
]
}
}
},
"response": {
"additionalProperties": false,
"properties": {},
"post_return_value_notes": [
"On success, if *enable* was *true*, notifications will be forwarded from then on."
]
},
"notifications": [
"Notifications are JSON-RPC objects without an *id* field. *lightningd* sends notifications (once enabled with this *notifications* command) with a *params* *id* field indicating which command the notification refers to.",
"",
"Implementations should ignore notifications without an *id* parameter, or unknown *method*.",
"",
"Common *method*s include:",
" *message*: param *message*: a descriptional string indicating something which occurred relating to the command. Param *level* indicates the level, as per lightning-getlog(7): *info* and *debug* are typical.",
" *progress*: param *num* and *total*, where *num* starts at 0 and is always less than *total*. Optional param *stage* with fields *num* and *total*, indicating what stage we are progressing through."
],
"errors": [
"On failure, one of the following error codes may be returned:",
"",
"- -32602: Error in given parameters."
],
"author": [
"Rusty Russell <<rusty@blockstream.com>> wrote the initial version of this man page."
],
"resources": [
"Main web site: <https://github.com/ElementsProject/lightning>"
],
"example_notifications": [
{
"method": "message",
"params": {
"id": 1,
"message": "This is a test message",
"level": "DEBUG"
}
},
{
"method": "progress",
"params": {
"id": 2,
"num": 0,
"total": 30,
"stage": {
"num": 0,
"total": 2
}
}
}
],
"examples": [
{
"request": {
"id": "example:notifications#1",
"method": "notifications",
"params": {
"enable": true
}
},
"response": {}
},
{
"request": {
"id": "example:notifications#2",
"method": "notifications",
"params": {
"enable": false
}
},
"response": {}
}
]
}