-
Notifications
You must be signed in to change notification settings - Fork 76
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
feat: optionally allow validatorOptions of class-validator #233
feat: optionally allow validatorOptions of class-validator #233
Conversation
…rinkstiekema/fireorm into feature/class-validator-options
Codecov Report
@@ Coverage Diff @@
## master #233 +/- ##
==========================================
+ Coverage 94.85% 94.88% +0.02%
==========================================
Files 24 24
Lines 583 586 +3
Branches 95 95
==========================================
+ Hits 553 556 +3
Misses 27 27
Partials 3 3
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good!
I don't love the idea to test the internals of ClassValidator inside BaseFirestoreRepository
(like testing if it whitelists or not) but I guess we have no other place to do it for now (until #198 is done).
I see that there are lint issues in the test, you can use prettier --write . to fix them 😄
Yes I think you are right. I wrote those tests like this to check whether the I might take some time to take up #198 sometime soon, as I think integrated validation is a great feature of FireORM. Might aswell show some appreciation for a great project! |
@all-contributors add @rinkstiekema for code |
I've put up a pull request to add @rinkstiekema! 🎉 |
🎉 This PR is included in version 0.20.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
The validate function from class-validator has the optional function
validatorOptions
. An example usage that makes sense for FireORM would be forbidding non-whitelisted values, such that document will not be polluted accidentally. Find validatorOptions documentation hereI have added an optional property
validatorOptions
toMetadataStorageConfig
, hope the code and tests are up to standards!