Skip to content

prost-types resolves some well known types to their rust counterparts #2526

@hermeGarcia

Description

@hermeGarcia

Bug Report

Version

v0.14.5

Platform

Darwin 192.168.1.131 24.6.0 Darwin Kernel Version 24.6.0: Mon Aug 11 21:16:05 PDT 2025; root:xnu-11417.140.69.701.11~1/RELEASE_X86_64 x86_64

Crates

tonic-prost-build

Description

When using the following well known types as input/output types in service definitions:

  • DoubleValue
  • FloatValue
  • Int32Value
  • Int64Value
  • UInt32Value
  • UInt64Value

cargo build will prefix the primitive type with super::, for example google.protobuf.UInt32Value translates into super::u32.

Reproducing this error is quite easy, just recreate the helloworld example and add the following method:

rpc SomeMethod (HelloRequest) returns (google.protobuf.UInt32Value) {}

I think the problem is that prost-build is already resolving such types into their primitive counterparts, hence tonic-prost-build receives u32 instead of the well known type.

I implemented this solution to take such primitive types into account, using my fork seems to compile fine the helloworld example. The approach is quite simple, I just added the primitive types that can be mapped from a well known type to NON_PATH_TYPE_ALLOWLIST.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions