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

Allow setting up grpcreflection for dynamic schemas #80

Closed
rauanmayemir opened this issue Oct 16, 2024 · 7 comments
Closed

Allow setting up grpcreflection for dynamic schemas #80

rauanmayemir opened this issue Oct 16, 2024 · 7 comments

Comments

@rauanmayemir
Copy link

Currently connectrpc.com/grpcreflect will not work with dynamic schemas.
It defers to protoregistry.GlobalFiles and even if I want to specify my own types, it is not trivial as I have to re-type all the things from under the hood to set up a custom Reflector.

@rauanmayemir
Copy link
Author

Correction, I cannot create a custom reflector with staticNames being private.

@jhump
Copy link
Member

jhump commented Oct 16, 2024

@rauanmayemir, the Namer interface is a simple single-method. You don't need staticNames. You can just provide your own implementation.

type names []string
func (n names) Names() []string {
    return n
}

@rauanmayemir
Copy link
Author

So I could actually inject my own implementation of Reflector, I'll try it then.

@rauanmayemir
Copy link
Author

While I can easily re-implement the namer part, almost everything is needed to be re-implemented as well due to private types: reflector, resolver, options.

@jhump
Copy link
Member

jhump commented Oct 16, 2024

I don't really understand what you are trying to do. You can easily use this repo with dynamic schemas using NewReflector and passing WithExtensionResolver and WithDescriptorResolver options, to provide custom resolvers for your dynamic schemas. The custom Namer can be used to customize the names returned from ListServices requests.

@rauanmayemir
Copy link
Author

Oh, let me try that. Yes, that's what I needed but only looked into the function implementations without accounting for options.

@rauanmayemir
Copy link
Author

It turned out to be trivial, thank you. 🙌

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