Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make constraint resolution more flexible to different concrete extens…
…ion types (#57) The go proto library struggles to resolve values for extensions if the concrete type associated with the generated source code on hand does not match that on the descriptor of the message in question (which happens in cases where the descriptor or message is produced at runtime). This manifested in the protovalidate resolver where the extension could not be found on options attached to a descriptor produced dynamically. Unfortunately, I struggled to find a way to get the extension and its value directly. (I'm not even sure how to get the field/ext descriptor from the descriptor; `protoreflect.Fields.ByNumber` doesn't work). The most straightforward solution from a few iterations was to leverage `proto.RangeExtensions`. There's room here for some mild optimization to short circuit in most vanilla situations but it makes it a bit less readable. Since this only happens once per descriptor, the optimization is overkill IMO.
- Loading branch information