mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
doc/schemas: tighten requirements.
If we have conditional fields, we often set `additionalProperties` `true` at the top-level, but then we have to make sure to cover all the possible combinations in conditionals, so unintended additions don't appear. This revealed missing fields in delinvoice, for example. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
bf74be3348
commit
fe161ff962
8
doc/lightning-delinvoice.7
generated
8
doc/lightning-delinvoice.7
generated
@ -25,6 +25,8 @@ On success, an object is returned, containing:
|
||||
.IP \[bu]
|
||||
\fBlabel\fR (string): Unique label given at creation time
|
||||
.IP \[bu]
|
||||
\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters)
|
||||
.IP \[bu]
|
||||
\fBstatus\fR (string): State of invoice (one of "paid", "expired", "unpaid")
|
||||
.IP \[bu]
|
||||
\fBexpires_at\fR (u64): UNIX timestamp when invoice expires (or expired)
|
||||
@ -32,6 +34,10 @@ On success, an object is returned, containing:
|
||||
\fBbolt11\fR (string, optional): BOLT11 string
|
||||
.IP \[bu]
|
||||
\fBbolt12\fR (string, optional): BOLT12 string
|
||||
.IP \[bu]
|
||||
\fBamount_msat\fR (msat, optional): the amount required to pay this invoice
|
||||
.IP \[bu]
|
||||
\fBdescription\fR (string, optional): description used in the invoice
|
||||
|
||||
.RE
|
||||
|
||||
@ -87,4 +93,4 @@ Rusty Russell \fI<rusty@rustcorp.com.au\fR> is mainly responsible\.
|
||||
|
||||
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
||||
|
||||
\" SHA256STAMP:28d1e97fe8e8925008b20815c55db569b7ed8dad33d958c0914945c71fb9d654
|
||||
\" SHA256STAMP:4cd2b2a9c5dd9ad04bede3efc80981e78e147b21312fa63389ab88f6a681e1ad
|
||||
|
@ -23,10 +23,13 @@ Note: The return is the same as an object from lightning-listinvoice(7).
|
||||
[comment]: # (GENERATE-FROM-SCHEMA-START)
|
||||
On success, an object is returned, containing:
|
||||
- **label** (string): Unique label given at creation time
|
||||
- **payment_hash** (hex): the hash of the *payment_preimage* which will prove payment (always 64 characters)
|
||||
- **status** (string): State of invoice (one of "paid", "expired", "unpaid")
|
||||
- **expires_at** (u64): UNIX timestamp when invoice expires (or expired)
|
||||
- **bolt11** (string, optional): BOLT11 string
|
||||
- **bolt12** (string, optional): BOLT12 string
|
||||
- **amount_msat** (msat, optional): the amount required to pay this invoice
|
||||
- **description** (string, optional): description used in the invoice
|
||||
|
||||
If **bolt12** is present:
|
||||
- **local_offer_id** (hex, optional): offer for which this invoice was created
|
||||
@ -68,4 +71,4 @@ RESOURCES
|
||||
|
||||
Main web site: <https://github.com/ElementsProject/lightning>
|
||||
|
||||
[comment]: # ( SHA256STAMP:8cd84ec57d229dacb6d6c52510334da87846f1c8eea7db286063a2513e8318cb)
|
||||
[comment]: # ( SHA256STAMP:eb1f069240a14c56d3fc336c56be2fed4f966d6aa2edaa5697ede821ebc5140b)
|
||||
|
2
doc/lightning-delpay.7
generated
2
doc/lightning-delpay.7
generated
@ -120,4 +120,4 @@ Vincenzo Palazzo \fI<vincenzo.palazzo@protonmail.com\fR> is mainly responsible\.
|
||||
|
||||
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
||||
|
||||
\" SHA256STAMP:520f0b56c7288ed46509a0ab90be0959b3b1489b56b7e94f223de19cf7028758
|
||||
\" SHA256STAMP:2c64d4cc71ef5cd6100f167abcd6219c7469f8fc0458799ef368b7394ffb02f2
|
||||
|
@ -99,4 +99,4 @@ RESOURCES
|
||||
---------
|
||||
|
||||
Main web site: <https://github.com/ElementsProject/lightning>
|
||||
[comment]: # ( SHA256STAMP:26e293e5b3de31a95572763a6d7c360c0f9f78112b3fcef12c639d001b0fa9b5)
|
||||
[comment]: # ( SHA256STAMP:ef20bfc63196d77869d8e8922dc6893231b0f02f9fdd80c9d3a252a58521f0da)
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"required": [ "label", "payment_hash", "amount_msat", "status", "expires_at" ],
|
||||
"required": [ "label", "payment_hash", "status", "expires_at" ],
|
||||
"additionalProperties": true,
|
||||
"properties": {
|
||||
"label": {
|
||||
@ -16,6 +16,23 @@
|
||||
"type": "string",
|
||||
"description": "BOLT12 string"
|
||||
},
|
||||
"msatoshi": {
|
||||
"deprecated": "true"
|
||||
},
|
||||
"amount_msat": {
|
||||
"type": "msat",
|
||||
"description": "the amount required to pay this invoice"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "description used in the invoice"
|
||||
},
|
||||
"payment_hash": {
|
||||
"type": "hex",
|
||||
"description": "the hash of the *payment_preimage* which will prove payment",
|
||||
"maxLength": 64,
|
||||
"minLength": 64
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"description": "State of invoice",
|
||||
@ -32,13 +49,44 @@
|
||||
"required": [ "bolt12" ]
|
||||
},
|
||||
"then": {
|
||||
"required": [ ],
|
||||
"required": [ ],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"label": { },
|
||||
"bolt12": { },
|
||||
"status": { },
|
||||
"expires_at": { },
|
||||
"msatoshi": { },
|
||||
"amount_msat": { },
|
||||
"description": { },
|
||||
"payment_hash": { },
|
||||
"pay_index": { },
|
||||
"amount_received_msat": { },
|
||||
"paid_at": { },
|
||||
"payment_preimage": { },
|
||||
"local_offer_id": {
|
||||
"type": "hex",
|
||||
"description": "offer for which this invoice was created"
|
||||
}
|
||||
}
|
||||
},
|
||||
"else": {
|
||||
"required": [ "bolt11" ],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"label": { },
|
||||
"bolt11": { },
|
||||
"status": { },
|
||||
"expires_at": { },
|
||||
"msatoshi": { },
|
||||
"amount_msat": { },
|
||||
"description": { },
|
||||
"payment_hash": { },
|
||||
"pay_index": { },
|
||||
"amount_received_msat": { },
|
||||
"paid_at": { },
|
||||
"payment_preimage": { }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -54,6 +102,15 @@
|
||||
"additionalProperties": false,
|
||||
"required": [ "pay_index", "amount_received_msat", "paid_at", "payment_preimage" ],
|
||||
"properties": {
|
||||
"label": { },
|
||||
"bolt11": { },
|
||||
"bolt12": { },
|
||||
"status": { },
|
||||
"expires_at": { },
|
||||
"msatoshi": { },
|
||||
"amount_msat": { },
|
||||
"description": { },
|
||||
"payment_hash": { },
|
||||
"pay_index": {
|
||||
"type": "u64",
|
||||
"description": "unique index for this invoice payment"
|
||||
@ -73,6 +130,22 @@
|
||||
"minLength": 64
|
||||
}
|
||||
}
|
||||
},
|
||||
"else": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"label": { },
|
||||
"bolt11": { },
|
||||
"bolt12": { },
|
||||
"status": { },
|
||||
"msatoshi": { },
|
||||
"amount_msat": { },
|
||||
"description": { },
|
||||
"payment_hash": { },
|
||||
"expires_at": { },
|
||||
"pay_index": { },
|
||||
"local_offer_id": { }
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -8,7 +8,7 @@
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": true,
|
||||
"additionalProperties": false,
|
||||
"required": [ "id", "payment_hash", "status", "amount_sent_msat", "created_at" ],
|
||||
"properties": {
|
||||
"id": {
|
||||
@ -26,6 +26,9 @@
|
||||
"enum": [ "pending", "failed", "complete" ],
|
||||
"description": "status of the payment"
|
||||
},
|
||||
"msatoshi_sent": {
|
||||
"deprecated": true
|
||||
},
|
||||
"amount_sent_msat": {
|
||||
"type": "msat",
|
||||
"description": "the amount we actually sent, including fees"
|
||||
@ -38,6 +41,9 @@
|
||||
"type": "pubkey",
|
||||
"description": "the final destination of the payment if known"
|
||||
},
|
||||
"msatoshi": {
|
||||
"deprecated": true
|
||||
},
|
||||
"amount_msat": {
|
||||
"type": "msat",
|
||||
"description": "the amount the destination received, if known"
|
||||
|
Loading…
Reference in New Issue
Block a user