-
Notifications
You must be signed in to change notification settings - Fork 913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complete the JSON schemas. #4594
Complete the JSON schemas. #4594
Conversation
61f4034
to
6637b11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look really good Rusty.
ack 6637b11
This test error proof that the JSON schema works, right? :-)
JSON report written to: report.json (69796936 bytes)
===Flaky Test Report===
test_htlc_accepted_hook_direct_restart failed (2 runs remaining out of 3).
<class 'jsonschema.exceptions.ValidationError'>
Additional properties are not allowed ('status' was unexpected)
Yep! And I fixed the schema! (Which updated the documentation!) |
912bc45
to
2823b27
Compare
In general, it's better to omit a field than put in a 'null', and putting variable-named fields in an object is also a bad idea. This is reflected in how hard this is to express in JSON schema, too. Others: 1. Remove the obsolete "funding": "LOCAL" from unopened channels, but add "opener": "local" as used in normal channels. 2. htlc cltv_expiry is a u16. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Deprecated: JSON-RPC: `listfunds` `channels` `funding_allocation_msat` and `funding_msat`: use `funding`. Changelog-Deprecated: JSON-RPC: `listfunds` `channels` `last_tx_fee`: use `last_tx_fee_msat`. Changelog-Deprecated: JSON-RPC: `listfunds` `channels` `closer` is now omitted if it does not apply, not JSON `null`.
That's a terrible, terrible idea. (Documentation comes in later patch which has the schema). Also, blockheight is a u32, so simplify. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Deprecated: JSON-RPC: `listtransactions` `outputs` `satoshis` field (use `msat` instead).
Makes it possible to write a decent JSON schema, but means we need to carry additional data, so we create a `struct plugin_command`. We remove the unused struct dynamic_plugin, too. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
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>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
And a new "u8" type. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
… lists. 1. listpeers has a deprecated `"closer": null`, which we need to handle in the schema, while trying not to damage our documentation too much. 2. Don't print a condition if there are no fields to print. 3. Allow a special "untyped" marker for multifundchannel which returns arbitrary JSON in a field. 4. Allow a single field return (for 'stop'). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is the most complex one. It gets its own commit. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Fixed: doc: Epic documentation rewrite: each now lists complete and accurate JSON output, tested against testsuite.
1. Hide the now-deprecated enable-autotor-v2-mode option. 2. Really don't print dev- options. 3. Don't print true and false as strings in some cases. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Fixed: JSON-RPC: `listconfigs` would list some boolean options as strings `"true"` or `"false"` instead of using JSON booleans.
This made me document what are options are now in plugins, too. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2823b27
to
44d53d9
Compare
Trivial rebase now #4585 is merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 44d53d9
Based on #4585, since that cleans up JSON outputs.
This has been a mammoth effort, but it finally works. So much documentation cleanups, and JSON output fixes in here.
Glad it's finally done!
(If someone wants to write schemas & auto-gen docs for the rpc hooks, go for it!)