-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
DON'T MERGE: Adding Psuedo-Type Info To RPC/REST JSON #753
Conversation
Thanks for this -- it's a good first step. Some remarks:
In the meantime i've brought OCaml-bitcoin up-to-date with Bitcoin Core 0.10. Even if you don't have experience with OCaml, understanding the API is simple enough. Consider for instance the type signature for addmultisigaddress: parameters are separated by the While most of the grunt work of updating the Bitcoin API reference could be reduced by using the OCaml-bitcoin API as a reference, I actually advise against it. I'm pretty sure it contains errors and/or inconsistencies, and one would be just propagating those errors. Also, some of the names I used for the types are obviously not explicit enough. |
@darioteixeira Thanks!
Agreed. I tried using a pipe, as you suggested in your email, but found that it only works well when everything is on one line, and we don't have space for that in the table unless we use much less descriptive names for the types. I'll try using "or", but I do note that I think (at least in this case), the Description field makes it clear that its either an address or key (as does the description of the array). The developer needs to read that text description anyway because the key set is further reduced to only those belonging to the wallet.
Definitely something to think about when this gets expanded.
I can add But our Markdown parser doesn't support rows that support multiple columns. Since all of our RPC tables are already in a class, maybe I can write a plugin to reformat the output. I'll see if I can find time to experiment with that. Thanks again! |
Yeah, I agree you can get away with just using a comma as long as the description field makes it clear you should be ORing the types.
Yes, Markdown may be convenient, but it's sorely lacking for more complex requirements. Slightly reducing the font size and using hover-tips may indeed be the best way around those limitations. |
Note: I think I've found a hack using CSS If it works out, it'll make the adding type information easier as I won't have to re-layout each table. |
@harding: things seem to be quiet on this front. Is there anything I can do to help move this forward? |
@darioteixeira sorry about that; this is still on my todo list. As we merged pull #758, we can now easily support alternative table layouts (including multiple rows per entry) on a per-table basis. I'll see if I can find time to update this pull later today to use that feature as a demonstration. I usually go through and update the RPC documentation when a new major version of Bitcoin Core enters the release candidate stage, so I think that would be an opportune time to add the type information. |
@harding: I agree that the most straightforward way to fix this is to review the RPC calls one by one and add the type information manually. Feel free to page me if you encounter any non-straightforward ones, and thanks again for your attention! |
This is a quick (but functional) mock-up of @darioteixeira's recent suggestion to bitcoin-development implemented for just a single RPC, AddMultiSigAddress.
We add a new section (preview) for types, which starts with a warning that the extended type definitions are non-normative.
The essential characteristics of each type are described. For this quick mock-up, I provided type details off the top of my head, and only did the types used by AddMultiSigAddress. For an actual pull, I'd of course check the code or run tests.
Then we use those types in the AddMultiSignature description (HTML preview), which looks like this:
To make some extra room, I renamed the Presence column to "#" and used symbolic representations of the previous text description. I dislike this---it's less clear---but space is limited.
That's it. Making some crude guesses, I think there's probably between 20 to 40 "types" that would need to be researched and written, and then all the tables would need to be updated, making for probably about a 10 to 20 hour update. The change seems useful enough, although probably not a high priority.
@darioteixeira comments? Anyone else, comments?