-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Client Validation Attributes #29
Comments
Yep, great suggestion, this is definitely something we wanna add here as a new feature. What you've suggested is along the lines of what @maraisr (FED on our team) and I were thinking I believe. I'm a bit strapped for time at the moment, but we could start designing it for now. One thing that this library currently doesn't do though is support the asp.net mvc / ComponentModel attributes. And to be honest, I'm not sure if we should. FluentValidation support was really the goal of this library. With the attributes, it becomes complicated to fire the validation (no such thing as Model.IsValid or whatever it is in an MVC action), and it didn't look 100% easy to abstract out that validation firing last time I looked. What might be easier is a shim between the attributes and FluentValidator, something I thought would've been done previously but I couldn't find anything last look. That way the attributes would be translated into FV world, and its then business as usual here. |
Something like this maybe: Actually no, that goes the other way, allows use of FV in |
I think we could invoke the adapters from FluentValidation.AspNetCore and translate the |
More than happy to accept a PR! Perhaps we could do it as a separate project and deployed nuget package so folks can opt-in to this addition. Maybe do a quick design in here and we can agree on an approach before you get stuck in. |
Consolidating this issue and a few others under #39 |
ASP.NET MVC has the ability to provide Client-side Model Validation to the browser as
data-val-*
attributes for usage with jQuery Validation.It would be fantastic if FairyBread could provide something similar for applications using a SPA stack (GraphQL + React etc.) by exposing the client-side validation attributes from ASP.NET MVC as a Yup Schema for usage with Formik and other form libraries.
The text was updated successfully, but these errors were encountered: