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

Assign the description to the request object in OpenAPI #886

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

bruwozniak
Copy link
Contributor

This fixes an issue where the doc comment description of an e.g. JSON parameter of a request would not show up in the generated API spec.

For example:

#[oai(path = "/users", method = "post", operation_id = "createUser")]
async fn create_user(
    &self,
    /// Parameters required to create a new user
    Json(params): Json<CreateUserParams>,
)

should translate to:

  /users:
    post:
      requestBody:
        description: Parameters required to create a new user
        content:
          application/json; charset=utf-8:
            schema:
              $ref: '#/components/schemas/CreateUserParams'
        required: true

but without this change description is missing.

This fixes an issue where the doc comment description of an e.g. JSON parameter of a request would not show up in the generated API spec.
@bruwozniak
Copy link
Contributor Author

@sunli829 could you please take a look? it's a relatively small one

@sunli829 sunli829 merged commit 77bb93c into poem-web:master Nov 25, 2024
@sunli829
Copy link
Collaborator

thanks

@bruwozniak bruwozniak deleted the patch-1 branch December 3, 2024 13:20
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

Successfully merging this pull request may close these issues.

2 participants