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

include {min|max}Items validation in rust-server models #17201

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

vances
Copy link
Contributor

@vances vances commented Nov 27, 2023

The JSON Schema Array validation keywords minItems and maxItems were missing in the template for model.rs.

Fixes #17136

@wing328
Copy link
Member

wing328 commented Nov 29, 2023

cc @frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05) @jacob-pro (2022/10)

@wing328
Copy link
Member

wing328 commented Nov 29, 2023

tested locally and the result is good. will add a test in another PR.

@wing328 wing328 merged commit 14c12fc into OpenAPITools:master Nov 29, 2023
16 checks passed
@@ -296,6 +296,19 @@ pub struct {{{classname}}} {
range(min = {{minimum}}),
{{/maximum}}
{{/minimum}}
{{#maxItems}}
{{#minItems}}
length(min = {{minItems}}, max = {{maxLength}}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxLength should be replaced by maxItems.

caught this issue when testing with both minItems and maxItems

will fix it in #17215

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, that would be the result of having used /Length/s//Items/ where /Length/s//Items/g was needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Array keyword minItems not in serde validator
2 participants