Closed chenyukang closed 1 week ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 44.45%. Comparing base (
f61ee09
) to head (7466c23
). Report is 2 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks for tackling this. It is a life quality improvement. I skimmed through the generator implementation.
Current implementation didn't consider foreign types in enum/struct fields, right? For example, the Multiaddr
parameter of the RPC connect_peer
is not documented (if we are using cargo doc to generate json files, I would expect we have foreign type information).
Another thing users want to know is how are these types serialized and deserialized. For example, if I want to pass a Multiaddr
to the RPC server, what is the appropriate format? I don't think it is quite possible for us to automatically document that, is it?
A small problem of the generated document is that it seems the type name of any Option
fields are quoted, while other type names are not. For example, below the type name Hash256
is not quoted but Option<u64>
is.
channel_id
- Hash256, Channel ID for the CKB payment.tlc_id
-Option<u64>
, TLC ID for the CKB payment.
yes, there are some improvements that need to be resolved:
Option<u64>
will be better in the format null
| u64
, and Option<SomeStruct>
will be in format null
| SomeStruct.
Some other ways I have tried:
cargo doc
, but it's only available for nightly version of rustc, and we also need to convert fromjson
format to markdown format.JsonSchema
for all data structures which need to be listed in markdown, I think it's an invasive change, and there are some trivial issues need to be resolved, such as https://github.com/GREsau/schemars/pull/251The current simple but dirty solution https://github.com/chenyukang/rpc-doc-gen is based on
syn
crate, which may have some pitfalls but I think we can improve it later.