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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bruwozniak
Copy link

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
Author

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

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.

1 participant