Skip to content
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

Is there a way to customize documentation for derive? #13

Closed
rw opened this issue Feb 13, 2020 · 4 comments
Closed

Is there a way to customize documentation for derive? #13

rw opened this issue Feb 13, 2020 · 4 comments

Comments

@rw
Copy link

rw commented Feb 13, 2020

First of all, I want to say thank you for this fantastic library!

The Rust types I'm using with schemars already have lots of doc comments. I'd like schemas, via derive(JsonSchema), to skip those doc comments (they are too long). Ideally, I'd like to configure my own comments for just json schema generation. Is this possible?

Thanks!

@GREsau
Copy link
Owner

GREsau commented Feb 15, 2020

It's not currently possible, but adding a new option to SchemaSettings to allow opting-out of processing doc comments would certainly be do-able, I'll take a closer look when I get more time

@GREsau
Copy link
Owner

GREsau commented May 17, 2020

I'm implementing this now, you'll be able to include an attribute to override any title/description from doc comments like so:

#[derive(JsonSchema)]
pub struct OverrideDocs {

    /// This comment will not be used as the description
    #[schemars(description = "This is the description!")]
    pub my_int: i32,

    /// This field will have no description set
    #[schemars(description = "")]
    pub my_undocumented_bool: bool,
}

@GREsau
Copy link
Owner

GREsau commented May 17, 2020

The above change is implemented in v0.7.5

@GREsau GREsau closed this as completed May 17, 2020
@rw
Copy link
Author

rw commented May 17, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants