-
Notifications
You must be signed in to change notification settings - Fork 107
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
Provide a convenient way to create a Result when using fluentvalidation #16
Comments
My initial investigations in converting the ValidationResult from FluentValidation into an Their The trouble here is they provide a much richer model in their ValidationFailure class, primarily due to the constraints imposed by the need to convert an I guess this raised some fundamental questions about what ValidationError on a result should be for and fundamentally if the intent of the project is to provide a Result type intended for REST API compatibility or for more general use within a Domain model. In either case, consideration would also need to be given to the following:
At the end of the day, this all comes back to if the design of Result should be limited by a requirement to be compatible with WebAPI and if it should or shouldn't become an envelope in that context especially when considered in the context of a RESTFUL approach. |
Revisiting this. For now, I think it's helpful to implement multiple string-based messages in a set of validation errors. I'll accept a PR with just that shortly (I think #24 is out of date so I'll probably take a new one but the end result should be the same). I think the action item from this issue (16) should be to create new samples:
I think the course of implementing these two samples we will uncover specific problems/incompatibilities as you've described above and we'll address them in that context. |
Sorry I got distracted by other work and let this go asside. Agree with the above and will wait for that before looking at this any further. |
FYI - I have integrated the latest package into my project without issue (see this commit Until Ardalis.Result.FluentValidation is available as a NuGet package I have cloned FluentValidationResultExtensions.cs in my project. This has saved about 10 lines of code per API call! thanks 👍 |
Awesome, glad to hear it! Why did you need to clone the extensions vs. using them from the package, here: I assume you have some changes you need to make that are specific to your project? |
I thought it was a separate NuGet package? Couldn't find it listed as such. |
Oh right, sorry. It's waiting on me to fix the deploy by updating my nuget.org key. I'll try to knock that out today and will confirm here when the package is published. |
Published here now: Should be available momentarily. |
Create an extension method or some other mechanism that provides an easy way to convert from a FluentValidation.ValidationResult to an Ardalis.Result
See https://github.com/FluentValidation
This will be implemented with a new project to prevent anyone from needing to take an implicit dependency on the FluentValidation package if they only want to use the main Ardalis.Result package
The text was updated successfully, but these errors were encountered: