Skip to content

Commit

Permalink
Add ResolvePredefinedConstraints method to DefaultResolver
Browse files Browse the repository at this point in the history
  • Loading branch information
jchadwick-buf committed Oct 2, 2024
1 parent b477f4c commit 2edf83c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions resolver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,11 @@ func (r DefaultResolver) ResolveOneofConstraints(desc protoreflect.OneofDescript
func (r DefaultResolver) ResolveFieldConstraints(desc protoreflect.FieldDescriptor) *validate.FieldConstraints {
return extensions.Resolve[*validate.FieldConstraints](desc.Options(), validate.E_Field)
}

// ResolvePredefinedConstraints returns the PredefinedConstraints option set for
// the FieldDescriptor. Note that this value is only meaningful if it is set on
// a field or extension of a field rule message. This method is provided for
// convenience.
func (r DefaultResolver) ResolvePredefinedConstraints(desc protoreflect.FieldDescriptor) *validate.PredefinedConstraints {
return extensions.Resolve[*validate.PredefinedConstraints](desc.Options(), validate.E_Predefined)
}

0 comments on commit 2edf83c

Please sign in to comment.