-
-
Notifications
You must be signed in to change notification settings - Fork 301
Add minProperties/maxProperties #1100
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
Add minProperties/maxProperties #1100
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Thank you for creating this PR! Please group only related actions into a single PR, as in these cases the I think I would rename |
9c58515 to
a22dba0
Compare
a22dba0 to
095b9d3
Compare
095b9d3 to
6e78edf
Compare
6e78edf to
1943878
Compare
|
Split them and renamed. |
|
I will try to review and merge this PR next week. |
commit: |
|
np, take your time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds new minProperties and maxProperties validation actions in both the website and library packages to support JSON Schema validation of object property counts.
- Implements minProperties and maxProperties actions along with their corresponding issue and error message types.
- Introduces new property configuration files for the website API routes and comprehensive tests (including type tests) in the library.
- Updates the actions index to export the new actions.
Reviewed Changes
Copilot reviewed 22 out of 31 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| website/src/routes/api/(actions)/minProps/properties.ts | Defines minProps action properties for the website API. |
| website/src/routes/api/(actions)/maxProps/properties.ts | Defines maxProps action properties for the website API. |
| library/src/actions/minProps/minProps.ts | Implements the minProps validation action and its types. |
| library/src/actions/minProps/minProps.test.ts | Adds runtime tests for the minProps action. |
| library/src/actions/minProps/minProps.test-d.ts | Adds TypeScript tests for the minProps action types. |
| library/src/actions/minProps/index.ts | Exports the minProps action. |
| library/src/actions/maxProps/maxProps.ts | Implements the maxProps validation action and its types. |
| library/src/actions/maxProps/maxProps.test.ts | Adds runtime tests for the maxProps action. |
| library/src/actions/maxProps/maxProps.test-d.ts | Adds TypeScript tests for the maxProps action types. |
| library/src/actions/maxProps/index.ts | Exports the maxProps action. |
| library/src/actions/index.ts | Updates the actions index to include new minProps and maxProps exports. |
Files not reviewed (9)
- website/src/routes/api/(actions)/maxProps/index.mdx: Language not supported
- website/src/routes/api/(actions)/minProps/index.mdx: Language not supported
- website/src/routes/api/(async)/pipeAsync/index.mdx: Language not supported
- website/src/routes/api/(methods)/pipe/index.mdx: Language not supported
- website/src/routes/api/(schemas)/looseObject/index.mdx: Language not supported
- website/src/routes/api/(schemas)/object/index.mdx: Language not supported
- website/src/routes/api/(schemas)/objectWithRest/index.mdx: Language not supported
- website/src/routes/api/(schemas)/record/index.mdx: Language not supported
- website/src/routes/api/(schemas)/strictObject/index.mdx: Language not supported
Comments suppressed due to low confidence (2)
library/src/actions/minProps/minProps.test.ts:31
- [nitpick] The error message 'item should contain at least two items' might be misleading in this context. Consider revising it to reference 'properties' instead of 'items' to more clearly match the minProperties validation.
expect(minProps(2, 'item should contain at least two items')).toStrictEqual({
library/src/actions/maxProps/maxProps.test.ts:31
- [nitpick] The error message 'item should contain at least two items' may not accurately describe a maximum properties condition. Consider updating it to clearly refer to 'properties' rather than 'items'.
expect(maxProps(2, 'item should contain at least two items')).toStrictEqual({
|
Thanks for the PR! Your code looks good. I will just do some minor refactoring. I will finish and merge it soon. |
b0e510b to
ff7eaae
Compare
ff7eaae to
43132fb
Compare
43132fb to
d295b84
Compare
d295b84 to
6b411cb
Compare
2c85c7a to
8adecf3
Compare
8adecf3 to
6b411cb
Compare
2655aff to
a5b8a22
Compare
e6f3fa6 to
bf2fcb8
Compare
4dfa683 to
f61f6df
Compare
f61f6df to
e6f7921
Compare
|
Valibot v1.1.0 is available! |
|
v1.1.0 of |
Add these validation actions:
looseObject(),object(),record()andstrictObject()` schemas to validate maximum amount of properties on an object, based on maxProperties from JSON Schema (https://json-schema.org/understanding-json-schema/reference/object#size)looseObject(),object(),record()andstrictObject()` schemas to validate minimum amount of properties on an object, based on minProperties from JSON Schema (https://json-schema.org/understanding-json-schema/reference/object#size)Update website with said actions