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
Comments
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? |
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. |
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. |
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. |
This is something that will be achieved after adding React API for the Hilla binder in #587 |
No description provided.
The text was updated successfully, but these errors were encountered: