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

Add full client side zod validation when creating an Entry - including it's Values #7

Open
Nils-Kolvenbach opened this issue Apr 27, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Nils-Kolvenbach
Copy link
Member

Currently the Client only validates against createEntrySchema when creating a new Entry. Here, values is a pretty generic array of unions that can be any possible Value.

Inside Core we are going a step further by validating each given Value by it's definition. This is done by finding the definition by ID and then calling the getValueContentSchemaFromDefinition() method of @elek-io/shared with it. This method generates the schema based on given definition which is then used to validate the Value with.

Because we are not doing the same thing on the Client, we only display a generic notification for the user if the schema validation fails inside Core. Ideally we can do the same we do in Core also in Client, to highlight the fields on errors and display the correct message next to it.

@Nils-Kolvenbach Nils-Kolvenbach added the enhancement New feature or request label Apr 27, 2024
@Nils-Kolvenbach Nils-Kolvenbach changed the title Add client side zod validation when creating an Entry Add full client side zod validation when creating an Entry - including it's Values Apr 27, 2024
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

No branches or pull requests

1 participant