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

feat: minimal implementation to support valibot #667

Merged
merged 21 commits into from
Jun 6, 2024

Conversation

MH4GF
Copy link
Contributor

@MH4GF MH4GF commented May 31, 2024

This PR implements valibot support.
First of all, only the contents of example/zod/schemas.ts are supported, not all configurations. Even at this point, the use case for my project can be met, and I plan to begin production operation when it is released.

Should documentation still be added in its current condition? I would like to discuss this.
After merging this PR, I will implement the test which is a todo.

@MH4GF MH4GF changed the title support valibot 2 feat: minimal implementation to support valibot May 31, 2024
@MH4GF MH4GF mentioned this pull request May 31, 2024
@@ -81,6 +82,7 @@
"ts-dedent": "^2.2.0",
"ts-jest": "29.1.4",
"typescript": "5.4.5",
"valibot": "0.31.0-rc.6",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

valibot is planning big breaking changes to its API in v.0.31.0. Since the old API is no longer available, this PR uses the rc version to comply with the new API.

ref: Migrate from v0.30.0 | Valibot

return `v.boolean()`;
}
console.warn('unhandled scalar name:', scalarName);
return 'v.any()';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since no type errors occurred, definedNonNullAny was implemented without using it.

@MH4GF MH4GF marked this pull request as ready for review May 31, 2024 14:02
@MH4GF
Copy link
Contributor Author

MH4GF commented May 31, 2024

@Code-Hex Sorry for the delay, please review at your convenience!

@Code-Hex
Copy link
Owner

Code-Hex commented Jun 6, 2024

What a great job @MH4GF !!
I'm checking this PR now 🙏

@MH4GF
Copy link
Contributor Author

MH4GF commented Jun 6, 2024

CI is down, so I'll merge the main branch 🏃🏻‍♂️

Comment on lines +123 to +125
// This function generates `[v.minLength(100), v.email()]`
// NOTE: valibot's API is not a method chain, so it is prepared separately from buildApi.
//
Copy link
Owner

Choose a reason for hiding this comment

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

Oh, I understand 👍

src/directive.ts Outdated Show resolved Hide resolved
@MH4GF MH4GF requested a review from Code-Hex June 6, 2024 06:05
Copy link
Owner

@Code-Hex Code-Hex left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you so much!

@Code-Hex Code-Hex merged commit 326f110 into Code-Hex:main Jun 6, 2024
2 checks passed
@MH4GF MH4GF deleted the support-valibot-2 branch June 6, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants