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

Add FieldLiteral proto message #2752

Merged
merged 23 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion private/pkg/protosource/option_extension_descriptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func isDescendantPath(descendant, ancestor []int32) bool {
return true
}

func (o *optionExtensionDescriptor) Range(fn func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
func (o *optionExtensionDescriptor) ForEachFieldDescriptor(fn func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
gilwong00 marked this conversation as resolved.
Show resolved Hide resolved
// Note: This does not bother to handle unrecognized fields.
// Should not be a problem since descriptors models in the buf CLI codebase should have them
// all correctly parsed and known.
Expand Down
7 changes: 4 additions & 3 deletions private/pkg/protosource/protosource.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,10 @@ type OptionExtensionDescriptor interface {
// have a set value on this descriptor.
PresentExtensionNumbers() []int32

// Range implements the same interface as protoreflect.Message. This takes
// in a callback that iterates over a protoreflect message field descriptors and values.
Range(fn func(protoreflect.FieldDescriptor, protoreflect.Value) bool)
// ForEachFieldDescriptor iterates through all fields present in the options message invoking
// the callback for each one. If the callback returns false, it terminates the
// iteration and returns immediately.
ForEachFieldDescriptor(fn func(protoreflect.FieldDescriptor, protoreflect.Value) bool)
}

// Location defines source code info location information.
Expand Down
Loading