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

Impl Example trait for NewType in poem-openapi #404

Closed
ZodiacWind opened this issue Oct 5, 2022 · 2 comments
Closed

Impl Example trait for NewType in poem-openapi #404

ZodiacWind opened this issue Oct 5, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@ZodiacWind
Copy link

ZodiacWind commented Oct 5, 2022

Description of the feature

I would like to use NewType such as

#[derive(NewType)]
pub struct MyString(String)

And I also want to generate example for it in my OpenAPI docs, is it possible to do that?

Code example (if possible)

#[derive(NewType)]
#[oai(exmpale)]
pub struct MyString(String)

impl Example for MyString {

    fn example() -> Self {
        Self("abc".to_string())
    }
}

@ZodiacWind ZodiacWind added the enhancement New feature or request label Oct 5, 2022
sunli829 added a commit that referenced this issue Oct 19, 2022
@sunli829
Copy link
Collaborator

Added in master branch 🙂

@ZodiacWind
Copy link
Author

ZodiacWind commented Oct 23, 2022

Added in master branch 🙂

Thanks, good job!

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

No branches or pull requests

2 participants