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

Tonic Relection needs a readme/howto #1522

Open
0xAlcibiades opened this issue Sep 16, 2023 · 8 comments
Open

Tonic Relection needs a readme/howto #1522

0xAlcibiades opened this issue Sep 16, 2023 · 8 comments

Comments

@0xAlcibiades
Copy link

Feature Request

Crates

tonic_reflection

Motivation

There are no usage examples and I had to reverse engineer the crate to use it.

Proposal

There should be a readme and/or crate documentation illustrating how to use tonic_reflection

Alternatives

Scour the web/roll my own, which made it hard to use the crate.

@jaredmcqueen
Copy link

+1 on this. Reflection is a little more spread-out than other examples. It's the build.rs, tonic-reflection in Cargo.toml, and finally the example file.

There are many more undocumented examples though, not just this one.

@0xAlcibiades
Copy link
Author

+1 on this. Reflection is a little more spread-out than other examples. It's the build.rs, tonic-reflection in Cargo.toml, and finally the example file.

There are many more undocumented examples though, not just this one.

I'd be down to write up an example if the maintainers would be open to a PR.

@0xAlcibiades
Copy link
Author

+1 on this. Reflection is a little more spread-out than other examples. It's the build.rs, tonic-reflection in Cargo.toml, and finally the example file.
There are many more undocumented examples though, not just this one.

I'd be down to write up an example if the maintainers would be open to a PR.

@jaredmcqueen is that a yes?

@jaredmcqueen
Copy link

I'll help out. I've written a few services with tonic now and know my way around reflection. I can't merge PRs though

@vastus
Copy link

vastus commented Oct 14, 2023

👀

@ollyde
Copy link

ollyde commented Dec 30, 2023

Also agree with this, the example is incomplete.

I cannot figure out how to implement tonic::include_file_descriptor_set!("test")

It just complains that there's no file, but the 'bin' isn't generated for the directory it's looking in, so I'm completely stuck.

build/protobrain-grpc-b9250147e4fbee18/out/test.bin

Screenshot 2023-12-30 at 17 07 26

The error is super cryptic

error: couldn't read /Users/oliverdixon/Projects/protobrain/protobrain-grpc/target/debug/build/protobrain-grpc-ce623c313148455c/out/test.bin: No such file or directory (os error 2)
 --> src/main.rs:5:51
  |
5 |     pub(crate) const FILE_DESCRIPTOR_SET: &[u8] = tonic::include_file_descriptor_set!("test");
  |                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in the macro `include_bytes` which comes from the expansion of the macro `tonic::include_file_descriptor_set` (in Nightly builds, run with -Z macro-backtrace for more info)

@LucioFranco
Copy link
Member

are you calling this tonic::include_file_descriptor_set!("test") in the same crate that you have the descriptor set in?

@grottohub
Copy link

i somehow missed this thread even though i scoured the entire repo for references to reflection 😂 and ended up making my own issue (#1600). ive got a PR out as well with an example (#1601), but am happy to include some actual documentation for how to get it working from scratch without relying on cloning the tonic repo for its build process

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

6 participants