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

React support for form validation rules generated from Java definitions #585

Closed
platosha opened this issue Oct 10, 2022 · 5 comments
Closed
Labels
hilla Issues related to Hilla react

Comments

@platosha
Copy link
Contributor

No description provided.

@marcushellberg
Copy link
Member

One thing we should look into quickly is: is there a validation format that we could also leverage as a base for other frameworks in the future if we decide to add support for Angular, Vue ...

It seems like Formik supports a yup validation schema. Based on a quick Google search, it seems that it's at least possible to use yup in both. But is there something that's better?

@cromoteca
Copy link
Contributor

Based on my little Angular experience at work, I wouldn't ask Angular developers to switch from the validation features provided by the framework. I don't know how it will be perceived to ask them to use Yup, if possible at all.

@marcushellberg
Copy link
Member

What I was thinking is that we could use the same generated schema to provide framework-appropriate solutions. So, for Lit we could have the binder ingest whatever format we have. For formik, it would be yup. For Angular, it would be something that's appropriate to Angular.

What I was getting at is that it would be nice if we didn't have to create a new server-side generator for each frontend framework.

Having a "generic" validation schema generated would also allow community members to have more flexibility to use it for other form libraries, frameworks. It would potentially help community members extend Hilla in ways they can't (easily) now.

@cromoteca
Copy link
Contributor

Who would translate that schema to Angular, Yup and so on? If that's up to the developer, that means some tedious work for him.

In general, each translation step works on the intersection between the two systems and brings limits. We already have the intersection between Java and TS, which is by design, but we already also have OpenAPI imposing some restrictions (for example limited support for generics in the generator); Yup would be another step. In fact, we could even skip Yup and generate a verbose Formik validation function for each entity.

@platosha platosha changed the title Formik support for validation rules generated from Java definitions React support for form validation rules generated from Java definitions Apr 24, 2023
@platosha
Copy link
Contributor Author

This is something that will be achieved after adding React API for the Hilla binder in #587

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hilla Issues related to Hilla react
Projects
Archived in project
Development

No branches or pull requests

3 participants