core-lightning/doc/schemas/listnodes.schema.json
Rusty Russell 1c8294ef1c doc: fix listnodes schema, doc.
Shows the dangers of "additionalProperties": true.  We didn't have an else
clause, so our incorrect (and, with DF, incomplete!) schema was accepted.

I despair of getting anyone else to write a decent schema with these
semantics :(

Changelog-Fixed: doc: listnodes fields now correctly documented.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-03 20:03:02 +09:30

135 lines
3.5 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"required": [ "nodes" ],
"properties": {
"nodes": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true,
"required": [ "nodeid" ],
"properties": {
"nodeid": {
"type": "pubkey",
"description": "the public key of the node"
},
"last_timestamp": {
"type": "u32",
"description": "A node_announcement has been received for this node (UNIX timestamp)"
}
},
"allOf": [
{
"if": {
"required": [ "last_timestamp" ]
},
"then": {
"additionalProperties": false,
"required": [ "nodeid", "last_timestamp", "alias", "color", "features", "addresses" ],
"properties": {
"nodeid": { },
"last_timestamp": { },
"option_will_fund": { },
"alias": {
"type": "string",
"description": "The fun alias this node advertized",
"maxLength": 32
},
"color": {
"type": "hex",
"description": "The favorite RGB color this node advertized",
"minLength": 6,
"maxLength": 6
},
"features": {
"type": "hex",
"description": "BOLT #9 features bitmap this node advertized"
},
"addresses": {
"type": "array",
"description": "The addresses this node advertized",
"items": {
"type": "object",
"required": [ "type", "address", "port" ],
"additionalProperties": false,
"properties": {
"type": {
"type": "string",
"enum": [ "ipv4", "ipv6", "torv2", "torv3" ],
"description": "Type of connection"
},
"address": {
"type": "string",
"description": "address in expected format for *type*"
},
"port": {
"type": "u16",
"description": "port number"
}
}
}
}
}
},
"else": {
"additionalProperties": false,
"properties": {
"nodeid": { }
}
}
},
{
"if": {
"required": [ "option_will_fund" ]
},
"then": {
"additionalProperties": true,
"required": [ "option_will_fund" ],
"properties": {
"option_will_fund": {
"type": "object",
"additionalProperties": false,
"required": [ "lease_fee_base_msat",
"lease_fee_basis",
"funding_weight",
"channel_fee_max_base_msat",
"channel_fee_max_proportional_thousandths",
"compact_lease" ],
"properties": {
"lease_fee_base_msat": {
"type": "msat",
"description": "the fixed fee for a lease (whole number of satoshis)"
},
"lease_fee_basis": {
"type": "u32",
"description": "the proportional fee in basis points (parts per 10,000) for a lease"
},
"funding_weight": {
"type": "u32",
"description": "the onchain weight you'll have to pay for a lease"
},
"channel_fee_max_base_msat": {
"type": "msat",
"description": "the maximum base routing fee this node will charge during the lease"
},
"channel_fee_max_proportional_thousandths": {
"type": "u32",
"description": "the maximum proportional routing fee this node will charge during the lease (in thousandths, not millionths like channel_update)"
},
"compact_lease": {
"type": "hex",
"description": "the lease as represented in the node_announcement"
}
}
}
}
}
}
]
}
}
}
}