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

Use first line of comment as title of newtype param #319

Closed
banool opened this issue Jul 18, 2022 · 0 comments
Closed

Use first line of comment as title of newtype param #319

banool opened this issue Jul 18, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@banool
Copy link
Contributor

banool commented Jul 18, 2022

Description of the feature

See the test in poem/poem-openapi/tests/newtype.rs. The comment there all gets converted into a description. This is different to regular structs that derive Object, they use the first line for the summary. It would be cool if the first line of the struct was used as the param title.

Code example (if possible)

I would expect this test to pass:

#[tokio::test]
async fn new_type_summary_and_description() {
    /// MyString
    ///
    /// A
    /// B
    /// C
    #[derive(NewType)]
    struct MyString(String);

    let schema = MyString::schema_ref();
    let schema = schema.unwrap_inline();
    assert_eq!(schema.title, Some("MyString"));
    assert_eq!(schema.description, Some("A\nB\nC"));
}

I can look at adding this myself later.

@banool banool added the enhancement New feature or request label Jul 18, 2022
@banool banool closed this as completed Jul 26, 2022
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

1 participant