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 shared field constraints #176

Closed
wants to merge 4 commits into from

Conversation

jchadwick-buf
Copy link
Member

  • Adds the ability to specify an ExtensionRegistry and a TypeRegistry for resolving protobuf messages. Ordinarily, only a TypeRegistry would necessarily be needed. However, we need to be able to resolve extensions defined in file descriptor sets we don't control, which means we need to be able to reparse to and from the user's descriptors in the worst case: to the user's descriptors to get the extended rule message (whose message type descriptors may have a different hashcode and thus may not resolve using just an ExtensionRegistry alone) and back from the user's descriptors in order to parse the priv/shared field.
  • Refactors some of the code around reparsing and extensions in general:
    • Reparsing options for protovalidate built-ins will always use a static extension registry.
  • Adds the rule variable.
    • Some refactoring is done around the individual rule compilation, since the code was getting a bit unwieldy.
  • Updates the conformance runner to generate an ExtensionRegistry and a TypeRegistry. This enables the conformance runner to pass both the old conformance test suite and the new one, regardless of whether the proto descriptors match up.

TODO:

  • Update to new version of protovalidate protos when they are merged.

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