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

151 lines
4.1 KiB
JSON

{
"$schema": "../rpc-schema-draft.json",
"type": "object",
"rpc": "listoffers",
"title": "Command for listing offers",
"warning": "experimental-offers only",
"description": [
"The **listoffers** RPC command list all offers, or with `offer_id`, only the offer with that offer_id (if it exists)."
],
"categories": [
"readonly"
],
"request": {
"required": [],
"additionalProperties": false,
"properties": {
"offer_id": {
"type": "hash",
"description": [
"Offer_id to get details for (if it exists)."
]
},
"active_only": {
"type": "boolean",
"description": [
"If set and is true, only offers with `active` true are returned."
]
}
}
},
"response": {
"required": [
"offers"
],
"additionalProperties": false,
"properties": {
"offers": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"offer_id",
"active",
"single_use",
"bolt12",
"used"
],
"properties": {
"offer_id": {
"type": "hash",
"description": [
"The id of this offer (merkle hash of non-signature fields)."
]
},
"active": {
"type": "boolean",
"description": [
"Whether this can still be used."
]
},
"single_use": {
"type": "boolean",
"description": [
"Whether this expires as soon as it's paid."
]
},
"bolt12": {
"type": "string",
"description": [
"The bolt12 encoding of the offer."
]
},
"used": {
"type": "boolean",
"description": [
"True if an associated invoice has been paid."
]
},
"label": {
"type": "string",
"description": [
"The (optional) user-specified label."
]
}
}
}
}
}
},
"author": [
"Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible."
],
"see_also": [
"lightning-offer(7)",
"lightning-listoffers(7)"
],
"resources": [
"Main web site: <https://github.com/ElementsProject/lightning>"
],
"examples": [
{
"request": {
"id": "example:listoffers#1",
"method": "listoffers",
"params": {
"active_only": true
}
},
"response": {
"offers": [
{
"offer_id": "dca9774ba2925b48c42eb12e599c09389d9d80d44445c4d0c944556c7228746e",
"active": true,
"single_use": false,
"bolt12": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqgn3qzs2ge5hx6pqwdskcefpzcssytfzxcs2xkdy0lml0tzy0jzugmyj8kjn8zfzrgq9fsgurc72x82e",
"used": false
},
{
"offer_id": "f901018768e13ea2da95f437749e24d22d47b2a6ea3030ef66ae0281df49d94b",
"active": true,
"single_use": false,
"bolt12": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqv85ysq2qepk7enxv4j3gqg2zcssytfzxcs2xkdy0lml0tzy0jzugmyj8kjn8zfzrgq9fsgurc72x82e",
"used": false
}
]
}
},
{
"request": {
"id": "example:listoffers#2",
"method": "listoffers",
"params": [
"b791f88cebf775853112c30828e116487f4d6c252d669372532b468bc7de8a24"
]
},
"response": {
"offers": [
{
"offer_id": "b791f88cebf775853112c30828e116487f4d6c252d669372532b468bc7de8a24",
"active": false,
"single_use": false,
"bolt12": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqv0gfqq2zp8kven9wgs8gmeqg35hxctzd3j3vggz953rvg9rtxj8lalh43z8epwydjfrmffn3y3p5qz5cywpu09rr4vs",
"used": false
}
]
}
}
]
}