Skip to content

Commit 9c4df89

Browse files
aristidispfacebook-github-bot
authored andcommitted
fbcode/common/hs/thrift/exactprint/tests/fbthrift-tests/default_values_rectification_before/src/module.thrift (+12 more)
Summary: Feedback/questions? Ping aristidisp. Reviewed By: vitaut Differential Revision: D80321851 fbshipit-source-id: d203ae96ca74d1ca4b8e95c7a08d186621d03e94
1 parent a866434 commit 9c4df89

13 files changed

Lines changed: 40 additions & 0 deletions

File tree

exactprint/tests/fbthrift-tests/default_values/src/module.thrift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
package "facebook.com/thrift/compiler/test/fixtures/default_values"
2222

23+
include "thrift/annotation/thrift.thrift"
24+
2325
struct TrivialStruct {
2426
1: i32 int_value;
2527
}
@@ -36,10 +38,12 @@ struct StructWithNoCustomDefaultValues {
3638

3739
struct StructWithCustomDefaultValues {
3840
1: i32 unqualified_integer = 42;
41+
@thrift.AllowUnsafeOptionalCustomDefaultValue
3942
2: optional i32 optional_integer = 43;
4043
3: required i32 required_integer = 44;
4144

4245
4: TrivialStruct unqualified_struct = TrivialStruct{int_value = 123};
46+
@thrift.AllowUnsafeOptionalCustomDefaultValue
4347
5: optional TrivialStruct optional_struct = TrivialStruct{int_value = 456};
4448
6: required TrivialStruct required_struct = TrivialStruct{int_value = 789};
4549
}

exactprint/tests/fbthrift-tests/default_values_rectification_before/src/module.thrift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
package "facebook.com/thrift/compiler/test/fixtures/default_values_rectification"
2222

23+
include "thrift/annotation/thrift.thrift"
24+
2325
struct EmptyStruct {}
2426

2527
struct TestStruct {
@@ -31,11 +33,15 @@ struct TestStruct {
3133

3234
4: EmptyStruct unqualified_struct_field = {};
3335

36+
@thrift.AllowUnsafeOptionalCustomDefaultValue
3437
5: optional i32 optional_int_field = 42;
3538

39+
@thrift.AllowUnsafeOptionalCustomDefaultValue
3640
6: optional bool optional_bool_field = true;
3741

42+
@thrift.AllowUnsafeOptionalCustomDefaultValue
3843
7: optional list<i32> optional_list_field = [1, 2];
3944

45+
@thrift.AllowUnsafeOptionalCustomDefaultValue
4046
8: optional EmptyStruct optional_struct_field = {};
4147
}

exactprint/tests/fbthrift-tests/from_map_construct/src/module.thrift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@
1818
* limitations under the License.
1919
*/
2020

21+
include "thrift/annotation/thrift.thrift"
22+
2123
struct Foo {
2224
1: list<string> a;
2325
2: optional map<string, list<set<i32>>> b;
2426
3: i64 c = 7;
27+
@thrift.AllowUnsafeOptionalCustomDefaultValue
2528
4: optional bool d = 0;
2629
}
2730

exactprint/tests/fbthrift-tests/go-typedef/src/module1.thrift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
include "module0.thrift"
2222
include "module2.thrift"
2323
include "thrift/annotation/go.thrift"
24+
include "thrift/annotation/thrift.thrift"
2425

2526
typedef string Plate
2627
typedef string State
@@ -34,6 +35,7 @@ typedef module2.Enum Enum
3435
struct Automobile {
3536
1: Plate plate;
3637
2: optional Plate previous_plate;
38+
@thrift.AllowUnsafeOptionalCustomDefaultValue
3739
3: optional Plate first_plate = "0000";
3840
4: Year year;
3941
5: Drivers drivers;

exactprint/tests/fbthrift-tests/hack-const-collections/src/module.thrift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@
1818
* limitations under the License.
1919
*/
2020

21+
include "thrift/annotation/thrift.thrift"
22+
2123
struct Foo {
2224
1: list<string> a;
2325
2: optional map<string, list<set<i32>>> b;
2426
3: i64 c = 7;
27+
@thrift.AllowUnsafeOptionalCustomDefaultValue
2528
4: optional bool d = 0;
2629
}
2730

exactprint/tests/fbthrift-tests/mcpp2-compare/src/extra_services.thrift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ struct containerStruct2 {
3333
202: optional map<string, bool> opt_fieldB;
3434
3: set<i32> fieldC = [1, 2, 3, 4];
3535
103: required set<i32> req_fieldC = [1, 2, 3, 4];
36+
@thrift.AllowUnsafeOptionalCustomDefaultValue
3637
203: optional set<i32> opt_fieldC = [1, 2, 3, 4];
3738
4: string fieldD;
3839
5: string fieldE = "somestring";
3940
105: required string req_fieldE = "somestring";
41+
@thrift.AllowUnsafeOptionalCustomDefaultValue
4042
205: optional string opt_fieldE = "somestring";
4143
}
4244

exactprint/tests/fbthrift-tests/mcpp2-compare/src/module.thrift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,12 @@ struct containerStruct {
191191
202: optional map<string, bool> opt_fieldB;
192192
3: set<i32> fieldC = [1, 2, 3, 4];
193193
103: required set<i32> req_fieldC = [1, 2, 3, 4];
194+
@thrift.AllowUnsafeOptionalCustomDefaultValue
194195
203: optional set<i32> opt_fieldC = [1, 2, 3, 4];
195196
4: string fieldD;
196197
5: string fieldE = "somestring";
197198
105: required string req_fieldE = "somestring";
199+
@thrift.AllowUnsafeOptionalCustomDefaultValue
198200
205: optional string opt_fieldE = "somestring";
199201
6: list<list<i32>> fieldF = aListOfLists;
200202
7: map<string, map<string, map<string, i32>>> fieldG;
@@ -213,6 +215,7 @@ struct containerStruct {
213215
17: MyEnumA fieldQ;
214216
18: MyEnumA fieldR = MyEnumA.fieldB;
215217
118: required MyEnumA req_fieldR = MyEnumA.fieldB;
218+
@thrift.AllowUnsafeOptionalCustomDefaultValue
216219
218: optional MyEnumA opt_fieldR = MyEnumA.fieldB;
217220
19: MyEnumA fieldS = constEnumA;
218221
21: list<MyEnumA> fieldT;

exactprint/tests/fbthrift-tests/optionals/src/module.thrift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
namespace java.swift test.fixtures.optionals
2222

23+
include "thrift/annotation/thrift.thrift"
24+
2325
struct Color {
2426
1: double red;
2527
2: double green;
@@ -38,6 +40,7 @@ struct Vehicle {
3840
2: optional string licensePlate;
3941
3: optional string description;
4042
4: optional string name;
43+
@thrift.AllowUnsafeOptionalCustomDefaultValue
4144
5: optional bool hasAC = false;
4245
}
4346

exactprint/tests/fbthrift-tests/php-migration/src/module.thrift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@
1818
* limitations under the License.
1919
*/
2020

21+
include "thrift/annotation/thrift.thrift"
22+
2123
struct Foo {
2224
1: list<string> a;
2325
2: optional map<string, list<set<i32>>> b;
2426
3: i64 c = 7;
27+
@thrift.AllowUnsafeOptionalCustomDefaultValue
2528
4: optional bool d = 0;
2629
}
2730

exactprint/tests/fbthrift-tests/py3/src/module.thrift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
include "thrift/annotation/cpp.thrift"
2222
include "thrift/annotation/python.thrift"
23+
include "thrift/annotation/thrift.thrift"
2324

2425
namespace cpp2 py3.simple
2526

@@ -76,10 +77,13 @@ struct SimpleStruct {
7677
@python.Py3Hidden{}
7778
8: i16 hidden_field;
7879
// @lint-ignore THRIFTCHECKS
80+
@thrift.AllowUnsafeOptionalCustomDefaultValue
7981
10: optional i32 opt_default_int = 2;
8082
// @lint-ignore THRIFTCHECKS
83+
@thrift.AllowUnsafeOptionalCustomDefaultValue
8184
11: optional string opt_default_str = "2";
8285
// @lint-ignore THRIFTCHECKS
86+
@thrift.AllowUnsafeOptionalCustomDefaultValue
8387
12: optional AnEnum opt_default_enum = AnEnum.THREE;
8488
}
8589

0 commit comments

Comments
 (0)