From 641ff99b07051c0f1153c18174c853f8c8e380c4 Mon Sep 17 00:00:00 2001 From: Walter Schulze Date: Thu, 19 Sep 2024 07:32:02 -0700 Subject: [PATCH] update rpcmetadata namespace to an open source friendly one Summary: update rpcmetadata namespace to an open source friendly one This way we can avoid copying the code into thrift/lib/go/thrift in future and rather import the generated code Reviewed By: podtserkovskiy Differential Revision: D63014121 fbshipit-source-id: 74d08d3f03dd0d228b95882a24826790354f871d --- thrift/compiler/generate/t_mstch_cpp2_generator.cc | 4 +++- thrift/lib/thrift/RpcMetadata.thrift | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/thrift/compiler/generate/t_mstch_cpp2_generator.cc b/thrift/compiler/generate/t_mstch_cpp2_generator.cc index f05e6e12c0b..0833df672ee 100644 --- a/thrift/compiler/generate/t_mstch_cpp2_generator.cc +++ b/thrift/compiler/generate/t_mstch_cpp2_generator.cc @@ -133,7 +133,8 @@ std::vector get_fatal_annotations( } std::string get_fatal_string_short_id(const std::string& key) { - return boost::algorithm::replace_all_copy(key, ".", "_"); + return boost::algorithm::replace_all_copy( + boost::algorithm::replace_all_copy(key, ".", "_"), "/", "_"); } std::string get_fatal_string_short_id(const t_named* node) { // Use the unmodified cpp name. @@ -144,6 +145,7 @@ std::string get_fatal_namespace_name_short_id( const std::string& lang, const std::string& ns) { std::string replacement = lang == "cpp" || lang == "cpp2" ? "__" : "_"; std::string result = boost::algorithm::replace_all_copy(ns, ".", replacement); + result = boost::algorithm::replace_all_copy(result, "/", "_"); return result; } diff --git a/thrift/lib/thrift/RpcMetadata.thrift b/thrift/lib/thrift/RpcMetadata.thrift index 3ba206b583f..32b453efaa2 100644 --- a/thrift/lib/thrift/RpcMetadata.thrift +++ b/thrift/lib/thrift/RpcMetadata.thrift @@ -26,7 +26,7 @@ namespace php Thrift_RpcMetadata namespace py thrift.lib.thrift.RpcMetadata namespace py.asyncio thrift.lib.thrift.asyncio.RpcMetadata namespace py3 thrift.lib.thrift -namespace go thrift.lib.thrift.rpcmetadata +namespace go 'github.com/facebook/fbthrift/thrift/lib/thrift/rpcmetadata' include "thrift/annotation/thrift.thrift" include "thrift/annotation/cpp.thrift"