2121include " includes.thrift"
2222include " thrift/annotation/cpp.thrift"
2323include " thrift/annotation/thrift.thrift"
24+
25+ @thrift.AllowLegacyMissingUris
26+ package;
27+
2428cpp_include " <folly/small_vector.h>"
2529
2630namespace cpp2 some.valid.ns
@@ -61,29 +65,38 @@ const i32 AnIntegerEnum2 = MyEnumA.fieldB;
6165
6266const list < i32 > ListOfIntsFromEnums = [MyEnumA.fieldB , MyEnumA.fieldA ];
6367
68+ @thrift.DeprecatedUnvalidatedAnnotations{
69+ items = {"cpp.declare_bitwise_ops": "1"},
70+ }
6471@cpp.EnumType{type = cpp.EnumUnderlyingType.U32}
6572enum AnnotatedEnum {
6673 FIELDA = 2 ,
6774 FIELDB = 4 ,
6875 FIELDC = 9 ,
69- } (cpp.declare_bitwise_ops)
76+ }
7077
78+ @thrift.DeprecatedUnvalidatedAnnotations{
79+ items = {"cpp.declare_bitwise_ops": "1"},
80+ }
7181@cpp.EnumType{type = cpp.EnumUnderlyingType.I16}
7282enum AnnotatedEnum2 {
7383 FIELDA = 2 ,
7484 FIELDB = 4 ,
7585 FIELDC = 9 ,
76- } (cpp.declare_bitwise_ops)
86+ }
7787
7888const MyEnumA constEnumA = MyEnumA.fieldB ;
7989
8090const MyEnumA constEnumB = 3 ;
8191
8292struct Empty {}
8393
94+ @thrift.DeprecatedUnvalidatedAnnotations{
95+ items = {"no_default_comparators": "1"},
96+ }
8497struct ASimpleStruct {
8598 1: i64 boolField ;
86- } (no_default_comparators)
99+ }
87100
88101struct ASimpleStructNoexcept {
89102 1: i64 boolField ;
@@ -107,10 +120,11 @@ struct MyStruct {
107120 11: optional CustomProtocolType MyOptCustomField ;
108121}
109122
123+ @thrift.DeprecatedUnvalidatedAnnotations{items = {"cpp.virtual": "1"}}
110124union SimpleUnion {
111125 7: i64 intValue ;
112126 2: string stringValue ;
113- } (cpp.virtual)
127+ }
114128
115129typedef i32 simpleTypeDef
116130typedef map<i16, string> containerTypeDef
@@ -176,13 +190,15 @@ exception AnException {
176190 21: optional CustomProtocolType MyOptCustomField ;
177191}
178192
193+ @thrift.DeprecatedUnvalidatedAnnotations{items = {"cpp.virtual": "1"}}
179194exception AnotherException {
180195 1: i32 code ;
181196 101: required i32 req_code ;
182197 2: string message ;
183- } (cpp.virtual)
198+ }
184199
185- struct containerStruct {
200+ @thrift.DeprecatedUnvalidatedAnnotations{items = {"cpp.noncopyable": "1"}}
201+ struct ContainerStruct {
186202 1: bool fieldA ;
187203 101: required bool req_fieldA ;
188204 201: optional bool opt_fieldA ;
@@ -233,12 +249,15 @@ struct containerStruct {
233249 30: MyEnumB fieldAC ;
234250 31: includes.AnEnum fieldAD ;
235251 32: map<string, i32> fieldAE = {};
236- } (cpp.noncopyable)
252+ }
237253
238254enum MyEnumB {
239255 AField = 0 ,
240256}
241257
258+ @thrift.DeprecatedUnvalidatedAnnotations{
259+ items = {"cpp2.declare_equal_to": "1", "cpp2.declare_hash": "1"},
260+ }
242261struct MyIncludedStruct {
243262 1: includes.IncludedInt64 MyIncludedInt = includes.IncludedConstant ;
244263 2: AStruct MyIncludedStruct ;
@@ -247,7 +266,7 @@ struct MyIncludedStruct {
247266 @cpp.AllowLegacyDeprecatedTerseWritesRef
248267 3: AStruct ARefField ;
249268 4: required AStruct ARequiredField ;
250- } (cpp2.declare_hash = 1, cpp2.declare_equal_to)
269+ }
251270
252271@cpp.Type{name = "CppFakeI32"}
253272typedef i32 CppFakeI32
@@ -257,8 +276,8 @@ typedef list<i64> FollySmallVectorI64
257276typedef set<string> SortedVectorSetString
258277@cpp.Type{name = "FakeMap"}
259278typedef map<i64, double> FakeMap
260- @cpp.Type{name = "std::unordered_map<std::string, containerStruct >"}
261- typedef map<string, containerStruct > UnorderedMapStruct
279+ @cpp.Type{name = "std::unordered_map<std::string, ContainerStruct >"}
280+ typedef map<string, ContainerStruct > UnorderedMapStruct
262281@cpp.Type{template = "std::list"}
263282typedef list <i32> std_list
264283@cpp.Type{template = "std::deque"}
@@ -268,58 +287,66 @@ typedef set<string> folly_set
268287@cpp.Type{template = "folly::sorted_vector_map"}
269288typedef map<i64, string> folly_map
270289
290+ @thrift.DeprecatedUnvalidatedAnnotations{
291+ items = {
292+ "cpp.declare_equal_to": "1",
293+ "cpp.declare_hash": "1",
294+ "cpp.noncopyable": "1",
295+ "cpp.virtual": "1",
296+ },
297+ }
271298struct AnnotatedStruct {
272- 1: containerStruct no_annotation ;
299+ 1: ContainerStruct no_annotation ;
273300 @cpp.Ref {type = cpp.RefType.Unique }
274301 @cpp.AllowLegacyNonOptionalRef
275302 @cpp.AllowLegacyDeprecatedTerseWritesRef
276- 2: containerStruct cpp_unique_ref ;
303+ 2: ContainerStruct cpp_unique_ref ;
277304 @cpp.Ref {type = cpp.RefType.Unique }
278305 @cpp.AllowLegacyNonOptionalRef
279306 @cpp.AllowLegacyDeprecatedTerseWritesRef
280- 3: containerStruct cpp2_unique_ref ;
307+ 3: ContainerStruct cpp2_unique_ref ;
281308 @cpp.Ref {type = cpp.RefType.Unique }
282309 @cpp.AllowLegacyNonOptionalRef
283310 @cpp.AllowLegacyDeprecatedTerseWritesRef
284311 4: map<i32, list<string>> container_with_ref ;
285312 @cpp.Ref {type = cpp.RefType.Unique }
286313 @cpp.AllowLegacyNonOptionalRef
287- 5: required containerStruct req_cpp_unique_ref ;
314+ 5: required ContainerStruct req_cpp_unique_ref ;
288315 @cpp.Ref {type = cpp.RefType.Unique }
289316 @cpp.AllowLegacyNonOptionalRef
290- 6: required containerStruct req_cpp2_unique_ref ;
317+ 6: required ContainerStruct req_cpp2_unique_ref ;
291318 @cpp.Ref {type = cpp.RefType.Unique }
292319 @cpp.AllowLegacyNonOptionalRef
293320 7: required list<string> req_container_with_ref ;
294321 @cpp.Ref {type = cpp.RefType.Unique }
295- 8: optional containerStruct opt_cpp_unique_ref ;
322+ 8: optional ContainerStruct opt_cpp_unique_ref ;
296323 @cpp.Ref {type = cpp.RefType.Unique }
297- 9: optional containerStruct opt_cpp2_unique_ref ;
324+ 9: optional ContainerStruct opt_cpp2_unique_ref ;
298325 @cpp.Ref {type = cpp.RefType.Unique }
299326 10: optional set<i32> opt_container_with_ref ;
300327 @cpp.Ref {type = cpp.RefType.Unique }
301328 @cpp.AllowLegacyDeprecatedTerseWritesRef
302329 @cpp.AllowLegacyNonOptionalRef
303- 11: containerStruct ref_type_unique ;
330+ 11: ContainerStruct ref_type_unique ;
304331 @cpp.Ref {type = cpp.RefType.SharedMutable }
305332 @cpp.AllowLegacyNonOptionalRef
306- 12: containerStruct ref_type_shared ;
333+ 12: ContainerStruct ref_type_shared ;
307334 @cpp.Ref {type = cpp.RefType.Shared }
308335 @cpp.AllowLegacyNonOptionalRef
309336 13: map<i32, list<string>> ref_type_const ;
310337 @cpp.Ref {type = cpp.RefType.SharedMutable }
311338 @cpp.AllowLegacyNonOptionalRef
312- 14: required containerStruct req_ref_type_shared ;
339+ 14: required ContainerStruct req_ref_type_shared ;
313340 @cpp.Ref {type = cpp.RefType.Shared }
314341 @cpp.AllowLegacyNonOptionalRef
315- 15: required containerStruct req_ref_type_const ;
342+ 15: required ContainerStruct req_ref_type_const ;
316343 @cpp.Ref {type = cpp.RefType.Unique }
317344 @cpp.AllowLegacyNonOptionalRef
318345 16: required list<string> req_ref_type_unique ;
319346 @cpp.Ref {type = cpp.RefType.Shared }
320- 17: optional containerStruct opt_ref_type_const ;
347+ 17: optional ContainerStruct opt_ref_type_const ;
321348 @cpp.Ref {type = cpp.RefType.Unique }
322- 18: optional containerStruct opt_ref_type_unique ;
349+ 18: optional ContainerStruct opt_ref_type_unique ;
323350 @cpp.Ref {type = cpp.RefType.SharedMutable }
324351 19: optional set<i32> opt_ref_type_shared ;
325352 20: CppFakeI32 base_type ;
@@ -343,17 +370,11 @@ struct AnnotatedStruct {
343370 34: folly_map typedef_map_template ;
344371 38: IOBuf iobuf_type_val = " value" ;
345372 39: IOBufPtr iobuf_ptr_val = " value2" ;
346- 40: containerStruct struct_struct = {
373+ 40: ContainerStruct struct_struct = {
347374 " fieldD" : " some string" ,
348375 " fieldI" : false ,
349376 };
350- } (
351- cpp.virtual,
352- cpp.noncopyable,
353- cpp.declare_hash,
354- cpp.declare_equal_to = 1,
355- cpp.methods = "void foo(const std::string& bar) {}",
356- )
377+ }
357378
358379struct ComplexContainerStruct {
359380 1: map<string, IOBuf> map_of_iobufs ;
@@ -449,6 +470,36 @@ service ParamService {
449470 set<MyStruct> setstruct_ret_set_param (8: set<string> param1 );
450471 ComplexUnion union_ret_i32_i32_param (4: i32 param1 , 2: i32 param2 );
451472 list<ComplexUnion> listunion_string_param (1: string param1 );
473+
474+ void annotatedParams (
475+ 1: ContainerStruct no_annotation ,
476+ 2: set<i32> opt_ref_type_shared ,
477+ 3: CppFakeI32 base_type ,
478+ 4: FollySmallVectorI64 list_type ,
479+ 5: SortedVectorSetString set_type ,
480+ 6: FakeMap map_type ,
481+ 7: UnorderedMapStruct map_struct_type ,
482+ 8: IOBuf iobuf_type ,
483+ 9: IOBufPtr iobuf_ptr ,
484+ @cpp.Type {template = " std::list" }
485+ 10: list<i32> list_i32_template ,
486+ @cpp.Type {template = " std::deque" }
487+ 11: list<string> list_string_template ,
488+ @cpp.Type {template = " folly::sorted_vector_set" }
489+ 12: set<string> set_template ,
490+ @cpp.Type {template = " folly::sorted_vector_map" }
491+ 13: map<i64, string> map_template ,
492+ 14: std_list typedef_list_template ,
493+ 15: std_deque typedef_deque_template ,
494+ 16: folly_set typedef_set_template ,
495+ 17: folly_map typedef_map_template ,
496+ 18: IOBuf iobuf_type_val = " value" ,
497+ 19: IOBufPtr iobuf_ptr_val = " value2" ,
498+ 20: ContainerStruct struct_struct = {
499+ " fieldD" : " some string" ,
500+ " fieldI" : false ,
501+ },
502+ );
452503}
453504
454505@cpp.Type{name = "folly::IOBuf"}
0 commit comments