Skip to content

Conversation

@muningis
Copy link
Contributor

@muningis muningis commented Mar 23, 2025

Add these validation actions:

Update website with said actions

@vercel
Copy link

vercel bot commented Mar 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
valibot ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 30, 2025 4:13am

@muningis muningis changed the title Draft: Add minProperties/maxProperties and isoDuration actions Add minProperties/maxProperties and isoDuration actions Mar 23, 2025
@fabian-hiller
Copy link
Member

Thank you for creating this PR! Please group only related actions into a single PR, as in these cases the isoDuration action may block the other actions to be merged as its regex seems a bit more complicated to review.

I think I would rename minProperties to minProps and maxProperties to maxProps. What do you think?

@fabian-hiller fabian-hiller self-assigned this Mar 23, 2025
@fabian-hiller fabian-hiller added the enhancement New feature or request label Mar 23, 2025
@muningis muningis force-pushed the json_schema_properties branch from 9c58515 to a22dba0 Compare March 23, 2025 15:42
@muningis muningis changed the title Add minProperties/maxProperties and isoDuration actions Add minProperties/maxProperties Mar 23, 2025
@muningis muningis force-pushed the json_schema_properties branch from a22dba0 to 095b9d3 Compare March 23, 2025 15:43
@muningis muningis force-pushed the json_schema_properties branch from 095b9d3 to 6e78edf Compare March 23, 2025 15:49
@muningis
Copy link
Contributor Author

Split them and renamed.

@fabian-hiller
Copy link
Member

I will try to review and merge this PR next week.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 23, 2025

Open in Stackblitz

npm i https://pkg.pr.new/valibot@1100

commit: e6f7921

@muningis
Copy link
Contributor Author

np, take your time.

@fabian-hiller fabian-hiller requested a review from Copilot March 28, 2025 02:33
Copy link
Contributor

Copilot AI left a 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({

@fabian-hiller
Copy link
Member

Thanks for the PR! Your code looks good. I will just do some minor refactoring. I will finish and merge it soon.

@fabian-hiller fabian-hiller merged commit d6586f7 into open-circle:main Mar 30, 2025
13 checks passed
@fabian-hiller fabian-hiller added this to the v1.1 milestone Apr 20, 2025
@fabian-hiller
Copy link
Member

Valibot v1.1.0 is available!

@fabian-hiller
Copy link
Member

v1.1.0 of toJsonSchema is available

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

Successfully merging this pull request may close these issues.

2 participants