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

Merged
merged 5 commits into from
Sep 23, 2024

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.

@jchadwick-buf jchadwick-buf merged commit b03f050 into main Sep 23, 2024
6 checks passed
@jchadwick-buf jchadwick-buf deleted the jchadwick/shared-field-rules branch September 23, 2024 16:30
jchadwick-buf added a commit that referenced this pull request Sep 23, 2024
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.

2 participants