Skip to content

fix(to-json-schema): do not mark exactOptional entry as required JSON property #1220

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

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

Conversation

sruenwg
Copy link
Contributor

@sruenwg sruenwg commented Jun 8, 2025

This PR fixes convertSchema to no longer mark exactOptional object properties as required properties in the output JSON Schema.
See playground example{} is clearly a valid value according to the schema, but the generated JSON Schema would reject this as it requires the k2 property.

Copy link

vercel bot commented Jun 8, 2025

@sruenwg is attempting to deploy a commit to the Valibot Team on Vercel.

A member of the Team first needs to authorize it.

@fabian-hiller fabian-hiller self-assigned this Jun 9, 2025
@fabian-hiller fabian-hiller added the fix A smaller enhancement or bug fix label Jun 9, 2025
Copy link

pkg-pr-new bot commented Jun 9, 2025

Open in StackBlitz

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

commit: 48e97e6

@fabian-hiller
Copy link
Owner

Thank you for your contribution! Not sure how we could miss that. I will merge it before releasing the next version of the package.

@fabian-hiller fabian-hiller added the priority This has priority label Jun 9, 2025
@sruenwg
Copy link
Contributor Author

sruenwg commented Jun 9, 2025

Thanks! 👍

@fabian-hiller fabian-hiller added this to the v1.4 (to-json-schema) milestone Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A smaller enhancement or bug fix priority This has priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants