Skip to content
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

add example using validator - closes #129 #647

Merged
merged 4 commits into from
Oct 10, 2021
Merged

add example using validator - closes #129 #647

merged 4 commits into from
Oct 10, 2021

Conversation

clux
Copy link
Member

@clux clux commented Oct 9, 2021

Time to put the ancient issue to rest now that the ecosystem has done all the work for us :-)

Minor expected caveat:

if you add #[validate(custom = "custom_validator_fn")] that does nothing to the schema.

not sure if that's worth warning about or not.

Signed-off-by: clux <sszynrae@gmail.com>
@clux clux linked an issue Oct 9, 2021 that may be closed by this pull request
Signed-off-by: clux <sszynrae@gmail.com>
@nightkr
Copy link
Member

nightkr commented Oct 9, 2021

I'd add a warning about that, yeah. Also worth mentioning that this validation only applies when modifying the object on the API side, so if you change the validation rules then you can't rely on old objects obeying them.

Signed-off-by: clux <sszynrae@gmail.com>
@clux
Copy link
Member Author

clux commented Oct 9, 2021

Added more docs; caveats when using validator and a segment about versioning (linking to the open issue).

examples/crd_api.rs Show resolved Hide resolved
Signed-off-by: clux <sszynrae@gmail.com>
@clux clux merged commit 88c5616 into master Oct 10, 2021
@clux clux deleted the validation-ex branch October 10, 2021 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

declarative openapi validation rules
3 participants