Separate RPC documentation from code #12761

issue karelbilek opened this issue on March 22, 2018
  1. karelbilek commented at 8:46 PM on March 22, 2018: contributor

    I think RPC documentation should be separated from the C++ code itself.

    It makes building more tools based on it needlessly complicated, and it also pads the RPC code too much.

    I have been thinking how to separate the RPC docs strings from the code itself. My 3 ideas

    • make some preprocessor macros and the documentation will be copied to the source code by the C++ pre-processor - that could be a good solution, but maybe hard to decypher?
    • keep the docs at separate files (in plaintext/possibly even markup) and let bitcoind read them at runtime - that could create annoying dependencies and probably introduce parsing errors?
    • keep the docs at separate files (in plaintext/markup) and "transpile" them somehow to the C++ code at make step

    Do you think it's a good idea? And which of the three possible ways is best?

  2. fanquake added the label Docs on Mar 22, 2018
  3. fanquake added the label RPC/REST/ZMQ on Mar 22, 2018
  4. ryanofsky commented at 12:35 AM on March 27, 2018: member

    Having the code "padded" with documentation seems like a good thing, not a bad thing to me. It makes the RPC code actually understandable (how else are you supposed to know what request.params[3] means?) and makes it less likely that documentation will become out of date when the code changes.

    Also, I could be missing something, but all of the suggestions above seem more complicated than the current help implementation, not simpler. I'd expect it would simplify tooling to structure the documentation, so it wouldn't be necessary to parse the big strings, instead of just moving the strings from one file to another.

  5. karelbilek commented at 9:37 AM on April 3, 2018: contributor

    Hm. I can see your point.

    The idea was just to make automated RPC documentation, such as the one on my experimental website, easier/trivial.

    But I also understand that it would make the doc quickly obsolete, as most other online documentations are for example. And since I don't have an idea how to do this in an easy and readable way, I am probably closing this

  6. karelbilek closed this on Apr 3, 2018

  7. ryanofsky commented at 11:11 AM on April 3, 2018: member

    The idea was just to make automated RPC documentation, such as the one on my experimental website, easier/trivial.

    It seems like structuring the documentation more (by breaking up the parameter return information instead of having it all in one big string) could make it easier to generate good documention. There is actually already an issue open for this: #4157, which could be a really nice improvement.

  8. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me