-
-
Notifications
You must be signed in to change notification settings - Fork 255
feat: add formData schema, checkbox action, and formDataEntries action #1142
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Thanks your for this PR! I think I would recommend using a library like What do you think? |
For more complex forms, I agree:
I still think there could be room for a built-in alternative for simpler forms, and then the user can switch when they need. Alternatively, it could be interesting to have an action wrapper for v.pipe(
v.formData(),
decodeFormData({
arrays: ['tags', 'images'],
booleans: ['active'],
dates: ['created', 'images.$.created'],
files: ['images.$.file'],
numbers: ['price'],
}),
finalSchema
) |
Yes, you are right. What is your use case for using |
just preference really - i like having the transformation contained in the schema, rather than having to do it separately before feeding it in similar to the json methods from #1137 |
Maybe it is a good idea to mention on what we are woking on in our v1.1 blog post so people can reach out if they are interested in this PR. |
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 PR introduces new schema and action functionality to handle formData and checkbox inputs. Key changes include:
- Adding a new formData schema along with its tests.
- Creating a formDataEntries transformation action to convert FormData into an object.
- Implementing a checkbox action to convert checkbox string values to booleans.
Reviewed Changes
Copilot reviewed 30 out of 34 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
website/src/routes/api/(actions)/formDataEntries/properties.ts | Adds property definitions for formDataEntries action. |
website/src/routes/api/(actions)/checkbox/properties.ts | Adds property definitions for checkbox action. |
library/src/schemas/formData/* | Introduces formData schema, implementation, and tests. |
library/src/actions/formDataEntries/* | Implements formDataEntries action with tests and type definitions. |
library/src/actions/checkbox/* | Implements checkbox action with tests and type definitions. |
Files not reviewed (4)
- library/tsconfig.json: Language not supported
- website/src/routes/api/(actions)/checkbox/index.mdx: Language not supported
- website/src/routes/api/(actions)/formDataEntries/index.mdx: Language not supported
- website/src/routes/api/(schemas)/formData/index.mdx: Language not supported
Given a form:
You could validate it: