Skip to content

Add support for shared field constraints #60

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

Closed
wants to merge 3 commits into from
Closed

Add support for shared field constraints #60

wants to merge 3 commits into from

Conversation

jchadwick-buf
Copy link
Member

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

There doesn't seem to be any practical way to either globally register extensions or have CppProtobuf recursively handle option extensions through a chosen MessageFactory/DescriptorPool so we wind up needing to push the logic to reparse dynamic extensions all the way down to the bottom when the rules structure is evaluated. This adds a small addition to the API surface, ValidatorFactory::SetMessageFactory, so that the end users (and conformance runner) can set a descriptor pool to use for reparsing.

TODO:

  • Update for protobuf changes in Implement predefined field constraints protovalidate#246. Has not been necessary for testing because the protos/extensions are backwards compatible.
  • Skip reparse when there are no empty fields—this way we can avoid pessimizing the common case (though the reparse is quite negligible in most cases.)

This will depend on bufbuild/protovalidate#246.

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