Closed mponizil closed 9 years ago
@mponizil there is no way to swap out the factory yet. I've got details in #14 about the next steps for adding this feature. The library was designed specifically to swap out validation engines, but that piece of the architecture hasn't been exposed to the users yet. I'm about a week out from fixing this issue in a major release. If you have another validation library you'd like to support please contribute the integration to this library when the latest major release is published. We currently have support for Joi and revalidator, all others are welcome.
Ahh thanks for the heads up, I shoulda reviewed #14. My use-case is actually just for one-off validators for now (MyValidators.NAME
, MyValidators.EMAIL
) -- need to keep a small file size, but liked the conventions provided by this mixin should I need to scale later.
Will definitely stay tuned for this update. Thanks!
@mponizil you can now write your own strategy as of 5.0
Great stuff, thanks @jurassix !
Hi there,
Very pleased with the simple and modular nature of this library. Thank you!
Perhaps I'm just being dense, but I can't find a way to swap out the validation strategy without modifying the source directly.
From https://github.com/jurassix/react-validation-mixin/issues/3#issuecomment-71263235:
Looking through the source, there doesn't seem to be a way to override
JoiValidationStrategy
besides modifyingValidationFactory
directly. My project useswebpack
, so I tried configuring an alias forValidationFactory
, but it seems aliasing a dependency of anode_modules
lib isn't supported, or I just couldn't figure it out. Regardless, I believe this is something the library should handle.Please forgive me if there's an obvious API I've overlooked, or let me know if one would be desired and I'd be happy to take a stab at a PR.
Cheers, Misha