You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm trying to generate code for the buf schema registry protobufs.
It generates the code but getting 2 compiler errors:
error[E0433]: failed to resolve: could not find `compiler` in `pbjson_types`
--> src/gen/buf.alpha.registry.v1alpha1.rs:555:61
|
555 | pub responses:::prost::alloc::vec::Vec<::pbjson_types::compiler::CodeGeneratorResponse>,
| ^^^^^^^^ could not find `compiler` in `pbjson_types`
error[E0283]: type annotations needed
--> src/gen/buf.alpha.registry.v1alpha1.rs:550:28
|
550 | #[derive(Clone,PartialEq,::prost::Message)]
| ^^^^^^^^^^^^^^^^ cannot infer type
|
= note: cannot satisfy `_: std::default::Default`
= note: this error originates in the derive macro `::prost::Message` (in Nightly builds, run with -Z macro-backtrace for more info)
The generated code for this section looks like this:
#[derive(Clone,PartialEq,::prost::Message)]pubstructGeneratePluginsResponse{/// Contains all the responses from the generated plugins. The order/// is defined by the order of the plugins in the request.#[prost(message, repeated, tag="1")]pubresponses:::prost::alloc::vec::Vec<::pbjson_types::compiler::CodeGeneratorResponse>,/// An optional array defining runtime libraries that the generated code/// requires to run, as specified by the plugin author. This may contain/// duplicate entries as the generation can be the result of multiple plugins,/// each of which declares its own runtime library dependencies. The libraries/// returned are lexicographically ordered by their name, but not deduplicated./// How to handle duplicate libraries is left to the user.#[prost(message, repeated, tag="2")]pubruntime_libraries:::prost::alloc::vec::Vec<RuntimeLibrary>,}
This may just be a mismatch with what the pbjson-types crate is actually providing. The compiler package is a part of the Google Protobuf Well-Known Types, but it looks like pbjson-types is not providing the code for those types (note the lack of a compiler module). If you don't strictly need Serde serialization/deserialization for those types, you may consider just using the compiler type definitions provided in prost-types. You may also be able to compile your own duplicates of the well known types, and then use an extern_paths directive to indicate that .google.protobuf.compiler should resolve to your own definitions. It's not a purely straightforward answer, unfortunately.
I might also encourage you to stop by the influxdb/pbjson repository and look to see if there's an issue requesting that the compiler package be added to their generated -types crate, or file one yourself if not.
Currently I think I can live without those types, how do I tell the code-gen to use the compiler type definitions provided in prost-types? Or alterntively, how do I tell the code-gen to completely skip generating the code for the GeneratePlugins rpc with its request and response types?
Hi, I'm trying to generate code for the buf schema registry protobufs.
It generates the code but getting 2 compiler errors:
The generated code for this section looks like this:
My
buf.gen.yaml
:And running it via
buf generate buf.build/bufbuild/buf:68da9dcf7ad819b7725e798deaf9ced5fe782e0f
My cargo.toml dependencies:
I don't know if this is a bug or if I'm doing something wrong?
The text was updated successfully, but these errors were encountered: