Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement predefined field constraints (#178)
- 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: - [x] Update to new version of protovalidate protos when they are merged. This will depend on bufbuild/protovalidate#246.
- Loading branch information