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

Implement predefined field constraints #61

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jchadwick-buf
Copy link
Member

@jchadwick-buf jchadwick-buf commented Sep 12, 2024

Like protovalidate-go and protovalidate-java, we need to adjust the code to handle dynamic descriptor sets more robustly, since we need to jump between resolving the protovalidate standard rules and the predefined rule extensions. This necessitates adding a couple of additions to the API surface, namely ValidatorFactory::SetMessageFactory and ValidatorFactory::SetAllowUnknownFields, which controls instantiation of unknown dynamic types and whether or not to ignore unresolved rules, respectively. Like other protovalidate runtimes, we will default to failing compilation when unknown predefined rules are encountered. This should not break existing users but will prevent silent incorrect behavior.

TODO:

This will depend on bufbuild/protovalidate#246.

@jchadwick-buf jchadwick-buf changed the title Add support for predefined field constraints Implement predefined field constraints Sep 12, 2024
@jchadwick-buf jchadwick-buf marked this pull request as ready for review September 19, 2024 17:58
@jchadwick-buf
Copy link
Member Author

Like with the other runtimes, we're currently blocked on updating the protos. That said, thanks to the wire compatibility of the updates, this PR should pass all of the relevant conformance tests in the new protovalidate version just fine. With that in mind, I would like to get the reviews started as soon as possible so we can keep things unblocked.

@jchadwick-buf
Copy link
Member Author

Updated to Protovalidate v0.8.1, should be good to go.

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.

1 participant