-
Notifications
You must be signed in to change notification settings - Fork 248
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
codegen: Opt out of documentation #843
Conversation
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
codegen/src/api/mod.rs
Outdated
@@ -82,6 +82,7 @@ where | |||
derives, | |||
type_substitutes, | |||
crate_path, | |||
true, |
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.
I reckon we should make sure that the #[subxt]
macro doesn't generate any docs, in this case (since they are sortof unnecessary there by default). We can always expose a flag in the macro args then to add docs if IDE's can ever learn to ebnefit from it :)
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.
That makes total sense! I've disabled by default the documentation generation for the subxt
macro and added a flag to its attributes: expose_documentation
, that when present the generated code will expose the metadata documentation
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
macro/src/lib.rs
Outdated
//! code, users must specify the `expose_documentation` flag: | ||
//! | ||
//! ```ignore | ||
//! #[subxt::subxt(expose_documentation)] |
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.
Nit: I feel like something like generate_docs
would make more sense, since that's really what's happening here
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.
I agree that generate_docs is a better choice:)
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.
I tweaked this quickly via the in-browser editor :)
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.
Nice!
This PR exposes the
--no-docs
flag by the CLI.When the flag is active the generated subxt API will not include the documentation from the metadata.
While at it, have also modified the
codegen
tests to check that no documentation present in the metadata-v14 is extracted on the generated API.Closes: #826.