You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I see that Bogus is heavily inspired by FluentValidation's sintax. I wonder if it's possible to integrate Bogus directly wiht FluentValidation's rules and validators. I mean, if I already have an AbstractValidator, can I use Bogus to generate data respecting the rules/constraints of that validator? (This would spare so much time for anyone using FluentValidation and xUnit)
The text was updated successfully, but these errors were encountered:
thiagomajesk
changed the title
Integrating Bogus with FluentValidations Rules
Integrating Bogus with FluentValidation's Rules
Jun 26, 2017
This sounds like a cool idea. Perhaps this could be done as a plugin or as an extension assembly Bogus.Plugin.FluentValidator. I think an extension assembly would be better at the moment so Bogus doesn't take a hard-dependency on FluentValidator.
Basically, to get something like this to work, you'll need to create some kind of AbstractValidator reader that translates FluentValidation's rules into Bogus rules. With FluentValildator's .With() and .Unless() and child/nested validators, I can imagine this reader-conversion could get very complex very fast; even with upcoming features like #8 and #74 that introduce "conventions".
I think it would take a decent amount of work to get your use-case operational. At the moment we won't have any immediate plans to do this. So, I'm going to close this issue for now.
If you feel strongly Bogus should have this feature, my suggestion would be to download the Bogus code, create a fork, or create a separate repo referencing Bogus and take a stab at implementing your feature. If you can come up with a rather complete solution, I'd be happy to take a look and possibly merge it into Bogus. I mean possibly because we'll have to weigh the benefits against the amount of complexity and maintainability that it may introduce. Additionally, if you find any pain points in extending Bogus, feel free to let me know; I'm pretty open to exposing Bogus' internal Faker<T> variables so you can extend it.
Hi! I see that Bogus is heavily inspired by FluentValidation's sintax. I wonder if it's possible to integrate Bogus directly wiht FluentValidation's rules and validators. I mean, if I already have an
AbstractValidator
, can I use Bogus to generate data respecting the rules/constraints of that validator? (This would spare so much time for anyone using FluentValidation and xUnit)The text was updated successfully, but these errors were encountered: