Skip to content

Commit

Permalink
doc/schemas: fixes for request schemas.
Browse files Browse the repository at this point in the history
Types are fixed, in particular:

* rename "OutputDesc" to more consistent "outputdesc".
* rename "utxo" to more consistent "outpoint".
* it's "boolean" not "bool".
* "number" means int or float, usually it should be u32.

Specific commands:

* close `id` can be by channel id, scid.
* close `feerange` is a feerate type.
* datastore/deldatastore/listdatastore `key` can be singleton.
* delexpiredinvoice: `maxexpirytime` is not required, is a u64.
* invoice/delinvoice/listinvoice `label` can be an integer
* fundpsbt: many fields are u32 not number (JSON for int or float).
* invoice: `msatoshi` can be "any".
* invoice: `expiry` has a type (now must be numeric).
* invoice: `exposeprivatechannels` can be bool or array of scids.
* invoice: `deschashonly` added
* keysend: there's no "float" type, use "number" or "u32" etc.
* keysend: `routehints` is a valid arg, as is `extratlvs` (EXPERIMENTAL_FEATURES)
* listdatastore: `key` is not required.
* newaddr: `addresstype` can be "all"
* pay: `exemptfee` is "msat", new fields `locaofferid` and `exclude`
* sendonion: was mis-formatted, missed `localofferid` and `groupid` fields.
* sendpay: add `localofferid` and `groupid` params.
* signpsbt: add `signonly` param.
* txprepare "outptus" typo.
* waitsendpay: add `groupid` and  fix `partid` type.
* withdraw: `destination` is a bitcoin address, not a pubkey.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Apr 1, 2022
1 parent 3b11292 commit b45b731
Show file tree
Hide file tree
Showing 23 changed files with 240 additions and 92 deletions.
7 changes: 6 additions & 1 deletion contrib/pyln-testing/pyln/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,12 @@ def dev_invoice(self, msatoshi, label, description, expiry=None, fallbacks=None,
"cltv": cltv,
"dev-routes": dev_routes,
}
return self.rpc.call("invoice", payload)
# FIXME? dev options are not in schema
old_check = self.rpc.check_request_schemas
self.rpc.check_request_schemas = False
ret = self.rpc.call("invoice", payload)
self.rpc.check_request_schemas = old_check
return ret


@contextmanager
Expand Down
10 changes: 5 additions & 5 deletions doc/schemas/close.request.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
],
"properties": {
"id": {
"type": "pubkey",
"description": ""
"type": "string",
"description": "peer id, channel id or short_channel_id"
},
"unilateraltimeout": {
"type": "u32",
Expand All @@ -31,9 +31,9 @@
"description": ""
},
"feerange": {
"type": {
"type": "array",
"items": "u32"
"type": "array",
"items": {
"type": "feerate"
},
"description": ""
}
Expand Down
2 changes: 1 addition & 1 deletion doc/schemas/connect.request.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
],
"properties": {
"id": {
"type": "pubkey",
"type": "string",
"description": ""
},
"host": {
Expand Down
21 changes: 16 additions & 5 deletions doc/schemas/datastore.request.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,22 @@
],
"properties": {
"key": {
"type": "array",
"description": "key is an array of values (though a single value is treated as a one-element array), to form a heirarchy. Using the first element of the key as the plugin name (e.g. [ 'summary' ]) is recommended. A key can either have children or a value, never both: parents are created and removed automatically.",
"items": {
"type": "string"
}
"oneOf": [
{
"type": "array",
"description": "key is an array of values (though a single value is treated as a one-element array), to form a heirarchy. Using the first element of the key as the plugin name (e.g. [ 'summary' ]) is recommended. A key can either have children or a value, never both: parents are created and removed automatically.",
"items": {
"type": "string"
}
},
{
"type": "string"
}
]
},
"string": {
"type": "string",
"description": ""
},
"hex": {
"type": "hex",
Expand Down
17 changes: 12 additions & 5 deletions doc/schemas/deldatastore.request.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@
],
"properties": {
"key": {
"type": "array",
"description": "key is an array of values (though a single value is treated as a one-element array), to form a heirarchy. Using the first element of the key as the plugin name (e.g. [ 'summary' ]) is recommended. A key can either have children or a value, never both: parents are created and removed automatically.",
"items": {
"type": "string"
}
"oneOf": [
{
"type": "array",
"description": "key is an array of values (though a single value is treated as a one-element array), to form a heirarchy. Using the first element of the key as the plugin name (e.g. [ 'summary' ]) is recommended. A key can either have children or a value, never both: parents are created and removed automatically.",
"items": {
"type": "string"
}
},
{
"type": "string"
}
]
},
"generation": {
"type": "u64",
Expand Down
6 changes: 2 additions & 4 deletions doc/schemas/delexpiredinvoice.request.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"required": [
"maxexpirytime"
],
"required": [],
"properties": {
"maxexpirytime": {
"type": "u32",
"type": "u64",
"description": ""
}
}
Expand Down
15 changes: 13 additions & 2 deletions doc/schemas/delinvoice.request.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@
],
"properties": {
"label": {
"type": "string",
"description": ""
"oneOf": [
{
"type": "string",
"description": ""
},
{
"type": "integer",
"description": ""
}
]
},
"status": {
"type": "string",
Expand All @@ -18,6 +26,9 @@
"expired",
"unpaid"
]
},
"desconly": {
"type": "boolean"
}
}
}
10 changes: 5 additions & 5 deletions doc/schemas/fundpsbt.request.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
"type": "feerate"
},
"startweight": {
"type": "number"
"type": "u32"
},
"minconf": {
"type": "number"
"type": "u32"
},
"reserve": {
"type": "number",
"type": "u32",
"description": "reserve is a number: if non-zero number then reserveinputs is called (successfully, with exclusive true) on the returned PSBT for this number of blocks (default: 72)."
},
"locktime": {
"type": "number"
"type": "u32"
},
"min_witness_weight": {
"type": "u32"
},
"excess_as_change": {
"type": "bool"
"type": "boolean"
}
}
}
37 changes: 31 additions & 6 deletions doc/schemas/invoice.request.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,27 @@
],
"properties": {
"msatoshi": {
"type": "msat|any",
"type": "msat_or_any",
"description": ""
},
"description": {
"type": "string",
"description": ""
},
"label": {
"type": "string",
"description": ""
"oneOf": [
{
"type": "string",
"description": ""
},
{
"type": "integer",
"description": ""
}
]
},
"expiry": {
"type": "",
"type": "u64",
"description": ""
},
"fallbacks": {
Expand All @@ -36,12 +44,29 @@
"description": ""
},
"exposeprivatechannels": {
"type": "bool",
"description": ""
"oneOf": [
{
"type": "boolean",
"description": ""
},
{
"type": "array",
"items": {
"type": "short_channel_id"
}
},
{
"type": "short_channel_id"
}
]
},
"cltv": {
"type": "u32",
"description": ""
},
"deschashonly": {
"type": "boolean",
"description": ""
}
}
}
45 changes: 42 additions & 3 deletions doc/schemas/keysend.request.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,55 @@
"type": "string"
},
"maxfeepercent": {
"type": "float"
"type": "number"
},
"retry_for": {
"type": "number"
"type": "u32"
},
"maxdelay": {
"type": "number"
"type": "u32"
},
"exemptfee": {
"type": "msat"
},
"routehints": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"scid",
"feebase",
"feeprop",
"expirydelta"
],
"properties": {
"id": {
"type": "pubkey"
},
"scid": {
"type": "short_channel_id"
},
"feebase": {
"type": "msat"
},
"feeprop": {
"type": "u32"
},
"expirydelta": {
"type": "u16"
}
}
}
}
},
"extratlvs": {
"type": "object",
"additionalProperties": true,
"required": []
}
}
}
22 changes: 14 additions & 8 deletions doc/schemas/listdatastore.request.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"required": [
"key"
],
"required": [],
"properties": {
"key": {
"type": "array",
"description": "key is an array of values (though a single value is treated as a one-element array), to form a heirarchy. Using the first element of the key as the plugin name (e.g. [ 'summary' ]) is recommended. A key can either have children or a value, never both: parents are created and removed automatically.",
"items": {
"type": "string"
}
"oneOf": [
{
"type": "array",
"description": "key is an array of values (though a single value is treated as a one-element array), to form a heirarchy. Using the first element of the key as the plugin name (e.g. [ 'summary' ]) is recommended. A key can either have children or a value, never both: parents are created and removed automatically.",
"items": {
"type": "string"
}
},
{
"type": "string",
"description": ""
}
]
}
}
}
12 changes: 10 additions & 2 deletions doc/schemas/listinvoices.request.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@
"required": [],
"properties": {
"label": {
"type": "string",
"description": ""
"oneOf": [
{
"type": "string",
"description": ""
},
{
"type": "integer",
"description": ""
}
]
},
"invstring": {
"type": "string",
Expand Down
3 changes: 2 additions & 1 deletion doc/schemas/newaddr.request.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"type": "string",
"enum": [
"bech32",
"p2sh-segwit"
"p2sh-segwit",
"all"
]
}
}
Expand Down
22 changes: 19 additions & 3 deletions doc/schemas/pay.request.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"type": "string"
},
"riskfactor": {
"type": "float"
"type": "number"
},
"maxfeepercent": {
"type": "f32"
"type": "number"
},
"retry_for": {
"type": "u16"
Expand All @@ -28,7 +28,23 @@
"type": "u16"
},
"exemptfee": {
"type": "f32"
"type": "msat"
},
"localofferid": {
"type": "hex"
},
"exclude": {
"type": "array",
"items": {
"oneOf": [
{
"type": "short_channel_id_dir"
},
{
"type": "pubkey"
}
]
}
}
}
}
Loading

0 comments on commit b45b731

Please sign in to comment.