-
-
Notifications
You must be signed in to change notification settings - Fork 328
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
Swap validator
for garde
#1212
Swap validator
for garde
#1212
Conversation
The validator crate used in the derive docs and in the crd example is no longer actively maintained. It has been superseded by garde which offers similar functionality. This change replaces validator with garde in dev dependencies (and in the crd_api example dependency). Although garde has the same derive macro, its attribute differs from validator, and it additionally requires fields to be explictly skipped from validation, and does not offer a built-in way to validate required fields. Changes have been made to the kube_derive crate's docs to both replace existing mentions of validator, and inform on the caveats mentioned above. Signed-off-by: Matei David <[email protected]>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1212 +/- ##
==========================================
- Coverage 73.49% 73.45% -0.04%
==========================================
Files 68 68
Lines 5349 5341 -8
==========================================
- Hits 3931 3923 -8
Misses 1418 1418
|
Signed-off-by: Matei David <[email protected]>
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.
Thanks for taking the time to dig into this. I think that given how clearly this ends up separating client-side and server-side validation, i think we should take garde out of our dev-dependencies and leave it as an example trick, but the docs are good. Left one bigger reword.
Signed-off-by: Matei David <[email protected]>
Signed-off-by: Matei David <[email protected]>
Co-authored-by: Eirik A <[email protected]> Signed-off-by: Matei David <[email protected]>
Signed-off-by: Matei David <[email protected]>
…be into matei/swap-validation-lib
Signed-off-by: Matei David <[email protected]>
@clux thanks for the review! I made a few changes:
Lmk how it looks, happy to finesse this more :) |
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.
Looks great now. Thank you!
Motivation
The validator crate used in the derive docs and in the crd example is no longer actively maintained. It has been superseded by garde which offers similar functionality.
Fixes #1197 (check issue for additional context)
Solution
This change replaces validator with garde in dev dependencies (and in the crd_api example dependency). Although garde has the same derive macro, its attribute differs from validator, and it additionally requires fields to be explictly skipped from validation, and does not offer a built-in way to validate required fields.
Changes have been made to the kube_derive crate's docs to both replace existing mentions of validator, and inform on the caveats mentioned above.