From 0a7661b5f084ad0bc43873b704bb64f8276cc555 Mon Sep 17 00:00:00 2001 From: Markus Pettersson Date: Tue, 19 May 2026 14:43:35 +0200 Subject: [PATCH] Fix mapping of well-known types when compiling a `FileDescriptionSet` Respect the recently added `Builder::with_extended_rust_types` when compiling a `FileDescriptionSet` via e.g. `Builder::compile_fds` or `Builder::compile_fds_with_config`. When `with_extended_rust_types` was added, only the code paths compiling .proto files from source were updated to include the extended mappings of well-known types. --- tonic-prost-build/src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tonic-prost-build/src/lib.rs b/tonic-prost-build/src/lib.rs index 055b511d7..bbf7c262e 100644 --- a/tonic-prost-build/src/lib.rs +++ b/tonic-prost-build/src/lib.rs @@ -904,6 +904,10 @@ impl Builder { config.include_file(path); } + if self.with_extended_rust_types { + NON_PATH_TYPE_ALLOWLIST.set(EXTENDED_NON_PATH_TYPE_ALLOWLIST); + } + // Note: We don't pass self.disable_comments to prost Config here // because those are meant for service/method paths which are handled // by the ServiceGenerator, not for message paths