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

288 lines
7.2 KiB
JSON

{
"$schema": "../rpc-schema-draft.json",
"type": "object",
"added": "v23.02",
"rpc": "listsqlschemas",
"title": "Command to example lightning-sql schemas",
"description": [
"This allows you to examine the schemas at runtime; while they are fully documented for the current release in lightning-sql(7), as fields are added or deprecated, you can use this command to determine what fields are present.",
"",
"If *table* is given, only that table is in the resulting list, otherwise all tables are listed."
],
"categories": [
"readonly"
],
"request": {
"required": [],
"additionalProperties": false,
"properties": {
"table": {
"type": "string"
}
}
},
"response": {
"required": [
"schemas"
],
"additionalProperties": false,
"properties": {
"schemas": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"tablename",
"columns"
],
"properties": {
"tablename": {
"type": "string",
"description": [
"The name of the table."
]
},
"columns": {
"type": "array",
"description": [
"The columns, in database order."
],
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"name",
"type"
],
"properties": {
"name": {
"type": "string",
"description": [
"The name of the column."
]
},
"type": {
"type": "string",
"enum": [
"INTEGER",
"BLOB",
"TEXT",
"REAL"
],
"description": [
"The SQL type of the column."
]
}
}
}
},
"indices": {
"type": "array",
"description": [
"Any index we created to speed lookups."
],
"items": {
"type": "array",
"description": [
"The columns for this index."
],
"items": {
"type": "string",
"description": [
"The column name."
]
}
}
}
}
}
}
}
},
"author": [
"Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible."
],
"see_also": [
"lightning-sql(7)"
],
"resources": [
"Main web site: <https://github.com/ElementsProject/lightning>"
],
"examples": [
{
"request": {
"id": "example:listsqlschemas#1",
"method": "listsqlschemas",
"params": {
"table": "offers"
}
},
"response": {
"schemas": [
{
"tablename": "offers",
"columns": [
{
"name": "rowid",
"type": "INTEGER"
},
{
"name": "offer_id",
"type": "BLOB"
},
{
"name": "active",
"type": "INTEGER"
},
{
"name": "single_use",
"type": "INTEGER"
},
{
"name": "bolt12",
"type": "TEXT"
},
{
"name": "used",
"type": "INTEGER"
},
{
"name": "label",
"type": "TEXT"
}
],
"indices": [
[
"offer_id"
]
]
}
]
}
},
{
"request": {
"id": "example:listsqlschemas#2",
"method": "listsqlschemas",
"params": [
"closedchannels"
]
},
"response": {
"schemas": [
{
"tablename": "closedchannels",
"columns": [
{
"name": "rowid",
"type": "INTEGER"
},
{
"name": "peer_id",
"type": "BLOB"
},
{
"name": "channel_id",
"type": "BLOB"
},
{
"name": "short_channel_id",
"type": "TEXT"
},
{
"name": "alias_local",
"type": "TEXT"
},
{
"name": "alias_remote",
"type": "TEXT"
},
{
"name": "opener",
"type": "TEXT"
},
{
"name": "closer",
"type": "TEXT"
},
{
"name": "private",
"type": "INTEGER"
},
{
"name": "total_local_commitments",
"type": "INTEGER"
},
{
"name": "total_remote_commitments",
"type": "INTEGER"
},
{
"name": "total_htlcs_sent",
"type": "INTEGER"
},
{
"name": "funding_txid",
"type": "BLOB"
},
{
"name": "funding_outnum",
"type": "INTEGER"
},
{
"name": "leased",
"type": "INTEGER"
},
{
"name": "funding_fee_paid_msat",
"type": "INTEGER"
},
{
"name": "funding_fee_rcvd_msat",
"type": "INTEGER"
},
{
"name": "funding_pushed_msat",
"type": "INTEGER"
},
{
"name": "total_msat",
"type": "INTEGER"
},
{
"name": "final_to_us_msat",
"type": "INTEGER"
},
{
"name": "min_to_us_msat",
"type": "INTEGER"
},
{
"name": "max_to_us_msat",
"type": "INTEGER"
},
{
"name": "last_commitment_txid",
"type": "BLOB"
},
{
"name": "last_commitment_fee_msat",
"type": "INTEGER"
},
{
"name": "close_cause",
"type": "TEXT"
},
{
"name": "last_stable_connection",
"type": "INTEGER"
}
]
}
]
}
}
]
}