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

protoset-out does not get namespace when using reflection #464

Closed
NGuldager opened this issue May 10, 2024 · 5 comments
Closed

protoset-out does not get namespace when using reflection #464

NGuldager opened this issue May 10, 2024 · 5 comments

Comments

@NGuldager
Copy link

Using -protoset-out to generate descriptors does not seem to keep namespaces for types when using reflection.

When comparing the descriptors using protoc --decode_raw for the same service using either the .proto file or reflection the field looks as follows

From reflection From .proto file
    1: "Identifier"
    2 {
      1: "type"
      3: 1
      4: 1
      5: 14
      6: "IdentifierType"
    }
  }
    1: "Identifier"
    2 {
      1: "type"
      3: 1
      4: 1
      5: 14
      6: ".reporting.consumption.IdentifierType"
      10: "type"
    }

Using reflection on the same server using https://github.com/fullstorydev/grpcui it sees that the namespace is definitely available for reflection:
image

Generating grpc clients fails if the namespace is not available, for a lot of reasons using the .proto file directly is not easily achievable, so getting the full type to the descriptors is highly preferable

@jhump
Copy link
Contributor

jhump commented May 10, 2024

What server implementation is returning that from the reflection endpoint? This seems like a clear bug in the reflection endpoint. If the type references are not qualified, they are not valid.

@NGuldager
Copy link
Author

NGuldager commented May 13, 2024

What server implementation is returning that from the reflection endpoint? This seems like a clear bug in the reflection endpoint. If the type references are not qualified, they are not valid.

We're using nestjs. But the grpcui is getting the correct namespace on the same server using reflection only. So I don't think it's in the server. But I might be wrong

@jhump
Copy link
Contributor

jhump commented May 13, 2024

But the grpcui is getting the correct namespace on the same server using reflection only.

This seems rather hard to understand since grpcui uses grpcurl as a library, and uses the exact same code to load/process the schemas.

What version of grpcurl and what version of grpcui?

@NGuldager
Copy link
Author

NGuldager commented May 14, 2024

After spending most of my day yesterday debugging and diving down into the code of various libraries. The issues seems to be with how protobufjs generates the binaries vs how protoc does.

From my understanding of grpcurl and grpcui, and please correct me if I'm wrong:

When using -protoset-out in grpcurl it just saves the descriptor exactly like the server reflection returns.
While grpcui uses GetFullyQualifiedName from protoreflect that does more than just show the type directly from the binary. Which also happens in grpcui, but only for the displayed values in the terminal, and not for the binary.

@NGuldager
Copy link
Author

The issues seems to be with how protobufjs generates the binaries vs how protoc does.

Closing because I don't think this is caused by grpcurl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants