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

Support for minItems and maxItems within request_body #1024

Open
fatihergin opened this issue Sep 4, 2024 · 1 comment
Open

Support for minItems and maxItems within request_body #1024

fatihergin opened this issue Sep 4, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@fatihergin
Copy link

Is this possible to define minItems and maxItems in request_body for array type parameters?
I would like to define sth. like:

#[utoipa::path(
    post,
    path = "/",
    request_body(
        my_objects = Vec<MyObject>,
        description = "...",
        min_items = 0,
        max_items = 5,
    ),
)]

Thank you.

@juhaku
Copy link
Owner

juhaku commented Sep 4, 2024

Currently this is not possible. Only way to define validation rules such as min_items and max_items is to define then on named field of named field struct. This is probably something that could be evaluated in future.

@juhaku juhaku added the enhancement New feature or request label Sep 4, 2024
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