Skip to content

Commit b327bd3

Browse files
committed
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 <[email protected]>
1 parent 7b2c791 commit b327bd3

File tree

139 files changed

+730
-298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+730
-298
lines changed

contrib/msggen/msggen/schema.json

Lines changed: 368 additions & 151 deletions
Large diffs are not rendered by default.

doc/rpc-schema-draft.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@
261261
"type": "object",
262262
"additionalProperties": false,
263263
"properties": {
264+
"additionalProperties": {
265+
"type": "boolean"
266+
},
264267
"required": {
265268
"type": "array",
266269
"items": {
@@ -290,6 +293,9 @@
290293
"type": "object",
291294
"additionalProperties": false,
292295
"properties": {
296+
"additionalProperties": {
297+
"type": "boolean"
298+
},
293299
"required": {
294300
"type": "array",
295301
"items": {

doc/schemas/lightning-addgossip.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"$schema": "../rpc-schema-draft.json",
33
"type": "object",
4-
"additionalProperties": false,
54
"rpc": "addgossip",
65
"title": "Command for injecting a gossip message (low-level)",
76
"description": [
@@ -15,6 +14,7 @@
1514
"required": [
1615
"message"
1716
],
17+
"additionalProperties": false,
1818
"properties": {
1919
"message": {
2020
"type": "hex",
@@ -25,6 +25,7 @@
2525
}
2626
},
2727
"response": {
28+
"additionalProperties": false,
2829
"properties": {}
2930
},
3031
"author": [

doc/schemas/lightning-addpsbtoutput.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"$schema": "../rpc-schema-draft.json",
33
"type": "object",
4-
"additionalProperties": false,
54
"added": "v23.11",
65
"rpc": "addpsbtoutput",
76
"title": "Command to populate PSBT outputs from the wallet",
@@ -14,6 +13,7 @@
1413
"required": [
1514
"satoshi"
1615
],
16+
"additionalProperties": false,
1717
"properties": {
1818
"satoshi": {
1919
"type": "sat",
@@ -47,6 +47,7 @@
4747
"estimated_added_weight",
4848
"outnum"
4949
],
50+
"additionalProperties": false,
5051
"properties": {
5152
"psbt": {
5253
"type": "string",

doc/schemas/lightning-askrene-age.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"$schema": "../rpc-schema-draft.json",
33
"type": "object",
4-
"additionalProperties": false,
54
"rpc": "askrene-age",
65
"title": "Command for expiring information in a layer (EXPERIMENTAL)",
76
"description": [
@@ -14,6 +13,7 @@
1413
"layer",
1514
"cutoff"
1615
],
16+
"additionalProperties": false,
1717
"properties": {
1818
"layer": {
1919
"type": "string",
@@ -34,6 +34,7 @@
3434
"layer",
3535
"num_removed"
3636
],
37+
"additionalProperties": false,
3738
"properties": {
3839
"layer": {
3940
"type": "string",

doc/schemas/lightning-askrene-create-channel.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"$schema": "../rpc-schema-draft.json",
33
"type": "object",
4-
"additionalProperties": false,
54
"rpc": "askrene-create-channel",
65
"title": "Command to add a channel to layer (EXPERIMENTAL)",
76
"description": [
@@ -17,6 +16,7 @@
1716
"short_channel_id",
1817
"capacity_msat"
1918
],
19+
"additionalProperties": false,
2020
"properties": {
2121
"layer": {
2222
"type": "string",
@@ -53,6 +53,7 @@
5353
},
5454
"response": {
5555
"required": [],
56+
"additionalProperties": false,
5657
"properties": {}
5758
},
5859
"see_also": [

doc/schemas/lightning-askrene-create-layer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"$schema": "../rpc-schema-draft.json",
33
"type": "object",
4-
"additionalProperties": false,
54
"rpc": "askrene-create-layer",
65
"title": "Command to create a new layer (EXPERIMENTAL)",
76
"description": [
@@ -13,6 +12,7 @@
1312
"required": [
1413
"layer"
1514
],
15+
"additionalProperties": false,
1616
"properties": {
1717
"layer": {
1818
"type": "string",
@@ -26,6 +26,7 @@
2626
"required": [
2727
"layers"
2828
],
29+
"additionalProperties": false,
2930
"properties": {
3031
"layers": {
3132
"type": "array",
@@ -74,6 +75,7 @@
7475
"short_channel_id",
7576
"capacity_msat"
7677
],
78+
"additionalProperties": false,
7779
"properties": {
7880
"source": {
7981
"type": "pubkey",
@@ -109,6 +111,7 @@
109111
"required": [
110112
"short_channel_id_dir"
111113
],
114+
"additionalProperties": false,
112115
"properties": {
113116
"htlc_minimum_msat": {
114117
"type": "msat",
@@ -151,6 +154,7 @@
151154
"short_channel_id",
152155
"direction"
153156
],
157+
"additionalProperties": false,
154158
"properties": {
155159
"short_channel_id": {
156160
"type": "short_channel_id",

doc/schemas/lightning-askrene-disable-node.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"$schema": "../rpc-schema-draft.json",
33
"type": "object",
4-
"additionalProperties": false,
54
"rpc": "askrene-disable-node",
65
"title": "Command to disable all channels to/from a node in a layer (EXPERIMENTAL)",
76
"description": [
@@ -14,6 +13,7 @@
1413
"layer",
1514
"node"
1615
],
16+
"additionalProperties": false,
1717
"properties": {
1818
"layer": {
1919
"type": "string",
@@ -31,6 +31,7 @@
3131
},
3232
"response": {
3333
"required": [],
34+
"additionalProperties": false,
3435
"properties": {}
3536
},
3637
"see_also": [

doc/schemas/lightning-askrene-inform-channel.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"$schema": "../rpc-schema-draft.json",
33
"type": "object",
4-
"additionalProperties": false,
54
"rpc": "askrene-inform-channel",
65
"title": "Command to add channel capacity restrictions to layer (EXPERIMENTAL)",
76
"description": [
@@ -16,6 +15,7 @@
1615
"amount_msat",
1716
"inform"
1817
],
18+
"additionalProperties": false,
1919
"properties": {
2020
"layer": {
2121
"type": "string",
@@ -52,6 +52,7 @@
5252
"required": [
5353
"constraints"
5454
],
55+
"additionalProperties": false,
5556
"properties": {
5657
"constraints": {
5758
"type": "array",
@@ -62,6 +63,7 @@
6263
"short_channel_id_dir",
6364
"timestamp"
6465
],
66+
"additionalProperties": false,
6567
"properties": {
6668
"short_channel_id_dir": {
6769
"type": "short_channel_id_dir",

doc/schemas/lightning-askrene-listlayers.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"$schema": "../rpc-schema-draft.json",
33
"type": "object",
4-
"additionalProperties": false,
54
"rpc": "askrene-listlayers",
65
"title": "Command to display information about layers (EXPERIMENTAL)",
76
"description": [
@@ -11,6 +10,7 @@
1110
],
1211
"request": {
1312
"required": [],
13+
"additionalProperties": false,
1414
"properties": {
1515
"layer": {
1616
"type": "string",
@@ -24,6 +24,7 @@
2424
"required": [
2525
"layers"
2626
],
27+
"additionalProperties": false,
2728
"properties": {
2829
"layers": {
2930
"type": "array",
@@ -72,6 +73,7 @@
7273
"short_channel_id",
7374
"capacity_msat"
7475
],
76+
"additionalProperties": false,
7577
"properties": {
7678
"source": {
7779
"type": "pubkey",
@@ -107,6 +109,7 @@
107109
"required": [
108110
"short_channel_id_dir"
109111
],
112+
"additionalProperties": false,
110113
"properties": {
111114
"short_channel_id_dir": {
112115
"type": "short_channel_id_dir",
@@ -160,6 +163,7 @@
160163
"required": [
161164
"short_channel_id_dir"
162165
],
166+
"additionalProperties": false,
163167
"properties": {
164168
"short_channel_id_dir": {
165169
"type": "short_channel_id_dir",

0 commit comments

Comments
 (0)