@@ -120,6 +120,7 @@ class t_json_generator : public t_generator {
120
120
void write_type_spec (t_type* ttype);
121
121
void write_string (const string& value);
122
122
void write_value (t_type* tvalue);
123
+ void write_legacy_names (t_type* ttype);
123
124
void write_const_value (t_const_value* value, bool force_string = false );
124
125
void write_key_and (string key);
125
126
void write_key_and_string (string key, string val);
@@ -571,6 +572,22 @@ void t_json_generator::generate_enum(t_enum* tenum) {
571
572
end_object ();
572
573
}
573
574
575
+ void t_json_generator::write_legacy_names (t_type* ttype) {
576
+ start_array ();
577
+ vector<t_name*> names = ttype->get_legacy_names ();
578
+
579
+ for (vector<t_name*>::iterator it = names.begin (); it != names.end (); ++it) {
580
+ write_comma_if_needed ();
581
+ start_object ();
582
+ write_key_and_string (" namespace" , (*it)->get_namespace ());
583
+ write_key_and_string (" name" , (*it)->get_name ());
584
+ end_object ();
585
+ indicate_comma_needed ();
586
+ }
587
+
588
+ end_array ();
589
+ }
590
+
574
591
void t_json_generator::generate_struct (t_struct* tstruct) {
575
592
start_object ();
576
593
@@ -584,6 +601,9 @@ void t_json_generator::generate_struct(t_struct* tstruct) {
584
601
585
602
write_key_and_bool (" isUnion" , tstruct->is_union ());
586
603
604
+ write_key_and (" legacyNames" );
605
+ write_legacy_names ((t_type*)tstruct);
606
+
587
607
write_key_and (" fields" );
588
608
start_array ();
589
609
vector<t_field*> members = tstruct->get_members ();
@@ -611,6 +631,9 @@ void t_json_generator::generate_service(t_service* tservice) {
611
631
write_key_and_string (" doc" , tservice->get_doc ());
612
632
}
613
633
634
+ write_key_and (" legacyNames" );
635
+ write_legacy_names ((t_type*)tservice);
636
+
614
637
write_key_and (" functions" );
615
638
start_array ();
616
639
vector<t_function*> functions = tservice->get_functions ();
0 commit comments