File tree Expand file tree Collapse file tree 4 files changed +9
-3
lines changed
third-party/thrift/src/thrift/compiler
templates/cpp2/service_cpp
test/fixtures/service-schema/out Expand file tree Collapse file tree 4 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -824,6 +824,8 @@ class cpp_mstch_service : public mstch_service {
824
824
&cpp_mstch_service::has_service_schema},
825
825
{" service:reduced_client?" , &cpp_mstch_service::reduced_client},
826
826
{" service:definition_key" , &cpp_mstch_service::definition_key},
827
+ {" service:definition_key_length" ,
828
+ &cpp_mstch_service::definition_key_length},
827
829
});
828
830
829
831
const auto all_functions = mstch_service::get_functions ();
@@ -910,6 +912,10 @@ class cpp_mstch_service : public mstch_service {
910
912
schematizer s (*service_->program ()->scope (), sm_, {});
911
913
return escape_binary_string (s.identify_definition (*service_));
912
914
}
915
+ mstch::node definition_key_length () {
916
+ schematizer s (*service_->program ()->scope (), sm_, {});
917
+ return escape_binary_string (s.identify_definition (*service_)).length ();
918
+ }
913
919
914
920
private:
915
921
const std::vector<t_function*>& get_functions () const override {
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ std::optional<apache::thrift::schema::DefinitionsSchema> {{> service_common/serv
30
30
{ {#program:has_schema?} }
31
31
std::optional<apache::thrift::schema::DefinitionsSchema > ret = schema::DefinitionsSchema{ } ;
32
32
ret->schema = ::apache::thrift::SchemaRegistry::mergeSchemas(::{ {service:qualified_namespace} }::{ {program:name} }_constants::{ {program:schema_name} }_includes());
33
- ret->definitions = { " {{service:definition_key}}" } ;
33
+ ret->definitions = { { " {{service:definition_key}}" , {{service:definition_key_length } }} };
34
34
return ret;
35
35
{ {/program:has_schema?} }
36
36
{ {^program:has_schema?} }
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ apache::thrift::ServiceHandler<::cpp2::PrimitivesService>::CreateMethodMetadataR
23
23
std::optional<apache::thrift::schema::DefinitionsSchema> apache::thrift::ServiceHandler<::cpp2::PrimitivesService>::getServiceSchema() {
24
24
std::optional<apache::thrift::schema::DefinitionsSchema> ret = schema::DefinitionsSchema{};
25
25
ret->schema = ::apache::thrift::SchemaRegistry::mergeSchemas (::cpp2::module_constants::_fbthrift_schema_b747839c13cb3aa5_includes ());
26
- ret->definitions = {" \x0d\x05\x1d\xbc\xb2\xd5\x1d\x8f\x95\x45\xbb\x51\xfa\xcf\x0f\xfe " };
26
+ ret->definitions = { { " \x0d\x05\x1d\xbc\xb2\xd5\x1d\x8f\x95\x45\xbb\x51\xfa\xcf\x0f\xfe " , 64 } };
27
27
return ret;
28
28
}
29
29
#endif
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ apache::thrift::ServiceHandler<::cpp2::PrimitivesService>::CreateMethodMetadataR
23
23
std::optional<apache::thrift::schema::DefinitionsSchema> apache::thrift::ServiceHandler<::cpp2::PrimitivesService>::getServiceSchema() {
24
24
std::optional<apache::thrift::schema::DefinitionsSchema> ret = schema::DefinitionsSchema{};
25
25
ret->schema = ::apache::thrift::SchemaRegistry::mergeSchemas (::cpp2::module_constants::_fbthrift_schema_b747839c13cb3aa5_includes ());
26
- ret->definitions = {" \x0d\x05\x1d\xbc\xb2\xd5\x1d\x8f\x95\x45\xbb\x51\xfa\xcf\x0f\xfe " };
26
+ ret->definitions = { { " \x0d\x05\x1d\xbc\xb2\xd5\x1d\x8f\x95\x45\xbb\x51\xfa\xcf\x0f\xfe " , 64 } };
27
27
return ret;
28
28
}
29
29
#endif
You can’t perform that action at this time.
0 commit comments