Skip to content

Commit

Permalink
Change order for how FileDescriptors are returned in reflection service.
Browse files Browse the repository at this point in the history
- FileDescriptors should be returned with the service first and then all dependencies after. All dependencies should occur after a FileDescriptor.
- See grpc/grpc-go#2949
  The Java implementation of the reflection service includes the entire transitive closure for a request file, in toplogical order such that a file's dependencies always appear after the file (so the requested file is first, with all of its dependencies after it).
  • Loading branch information
bjorkstromm committed Jan 24, 2021
1 parent e7d5887 commit 7395826
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/protobuf-net.Grpc.Reflection/ReflectionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,19 @@ public int Compare(FileDescriptorProto? left, FileDescriptorProto? right)
{
if (left is null)
{
return right is null ? 0 : -1;
return right is null ? 0 : 1;
}
if (right is null)
{
return 1;
return -1;
}
if (GetTransitiveDependencies(left).Contains(right.Name))
{
return 1;
return -1;
}
if (GetTransitiveDependencies(right).Contains(left.Name))
{
return -1;
return 1;
}

return string.Compare(left.Name, right.Name, StringComparison.Ordinal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ async IAsyncEnumerable<ServerReflectionRequest> GetRequest()
".ReflectionTest.BclService",
new[]
{
"ReflectionTest.BclService.proto",
"google/protobuf/empty.proto",
"protobuf-net/bcl.proto",
"ReflectionTest.BclService.proto"
"protobuf-net/bcl.proto"
}
,
new[]
Expand Down

0 comments on commit 7395826

Please sign in to comment.