Skip to content

Implement predefined field constraints#61

Merged
5 commits merged intomainfrom
jchadwick/shared-field-rules
Sep 23, 2024
Merged

Implement predefined field constraints#61
5 commits merged intomainfrom
jchadwick/shared-field-rules

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost 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.

@ghost ghost changed the title Add support for predefined field constraints Implement predefined field constraints Sep 12, 2024
@ghost ghost marked this pull request as ready for review September 19, 2024 17:58
@ghost ghost requested a review from Alfus September 19, 2024 18:03
@ghost
Copy link
Copy Markdown
Author

ghost commented Sep 19, 2024

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.

@ghost
Copy link
Copy Markdown
Author

ghost commented Sep 20, 2024

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

@ghost ghost merged commit b03f050 into main Sep 23, 2024
@ghost ghost deleted the jchadwick/shared-field-rules branch September 23, 2024 16:30
ghost pushed a commit that referenced this pull request Sep 23, 2024
This pull request was closed.
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