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

Add support for utoipa #85

Open
JohnScience opened this issue Jun 21, 2024 · 0 comments
Open

Add support for utoipa #85

JohnScience opened this issue Jun 21, 2024 · 0 comments

Comments

@JohnScience
Copy link

JohnScience commented Jun 21, 2024

I would like to use zxcvbn::feedback::Feedback as a field in an enum error type that is converted to JSON and returned in this form from an endpoint.

To generate Swagger documentation, I use utoipa.

To display the return type in Swagger documentation, I need to have the implementation of utoipa::ToSchema trait for zxcvbn::feedback::Feedback. Such implementation can be easily provided for a locally-defined item (e.g. a struct or an enum) via utoipa::ToSchema derive macro:

For example,

#[derive(ToSchema)]
struct Pet {
    #[schema(example = 1, default = 0)]
    id: u64,
    name: String,
    age: Option<i32>,
}

As a downstream user of both utoipa and zxcvbn, the easiest and the most logical option for me right now is to fork zxcvbn and use the patched fork instead of the original zxcvbn.

However, I'd love to see a utoipa feature in zxcvbn that would enable utoipa::ToSchema derive macro calls.

Thank you in advance!

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

1 participant