diff --git a/exactprint/tests/fbthrift-tests/any/src/module.thrift b/exactprint/tests/fbthrift-tests/any/src/module.thrift index a15f2983..352c392a 100644 --- a/exactprint/tests/fbthrift-tests/any/src/module.thrift +++ b/exactprint/tests/fbthrift-tests/any/src/module.thrift @@ -18,14 +18,21 @@ * limitations under the License. */ +include "thrift/annotation/thrift.thrift" + +@thrift.Uri{value = "facebook.com/thrift/compiler/test/fixtures/any/MyStruct"} struct MyStruct { 1: string myString; -} (thrift.uri = "facebook.com/thrift/compiler/test/fixtures/any/MyStruct") +} +@thrift.Uri{value = "facebook.com/thrift/compiler/test/fixtures/any/MyUnion"} union MyUnion { 1: string myString; -} (thrift.uri = "facebook.com/thrift/compiler/test/fixtures/any/MyUnion") +} +@thrift.Uri{ + value = "facebook.com/thrift/compiler/test/fixtures/any/MyException", +} exception MyException { 1: string myString; -} (thrift.uri = "facebook.com/thrift/compiler/test/fixtures/any/MyException") +} diff --git a/exactprint/tests/fbthrift-tests/basic-swift-bean/src/module.thrift b/exactprint/tests/fbthrift-tests/basic-swift-bean/src/module.thrift index bad61ce6..525fea32 100644 --- a/exactprint/tests/fbthrift-tests/basic-swift-bean/src/module.thrift +++ b/exactprint/tests/fbthrift-tests/basic-swift-bean/src/module.thrift @@ -20,6 +20,8 @@ namespace java.swift test.fixtures.basic_swift_bean +include "thrift/annotation/java.thrift" + enum MyEnum { MyValue1 = 0, MyValue2 = 1, @@ -35,11 +37,13 @@ struct MyStruct1 { 4: i64 major (cpp.name = "majorVer"); } +@java.Mutable struct MyStruct2 { 1: MyStruct1 myStruct1; 2: string myString; -} (java.swift.mutable = "true") +} +@java.Mutable struct MyStruct3 { 1: i16 myInt16 = 42; 2: i32 myInt32 = 422; @@ -59,17 +63,19 @@ struct MyStruct3 { }; 11: list myEmptyList = []; 12: map> myEmptyMapList = {}; -} (java.swift.mutable = "true") +} +@java.Mutable struct MyDataItem { 1: i32 field1; 2: i32 field2; -} (java.swift.mutable = "true") +} +@java.Mutable struct LegacyStruct { 1: i32 normal; -1: i32 bad; -} (java.swift.mutable = "true") +} const MyStruct1 ms = { "MyIntField": 42, diff --git a/exactprint/tests/fbthrift-tests/big-struct/src/module.thrift b/exactprint/tests/fbthrift-tests/big-struct/src/module.thrift index 322391bf..f8ae614b 100644 --- a/exactprint/tests/fbthrift-tests/big-struct/src/module.thrift +++ b/exactprint/tests/fbthrift-tests/big-struct/src/module.thrift @@ -20,6 +20,8 @@ namespace java.swift test.fixtures.basic +include "thrift/annotation/java.thrift" + struct MyNomralStruct { 1: string msg1; 2: string msg2; @@ -313,6 +315,7 @@ struct MyBigStruct { 257: string msg257; } +@java.Mutable struct MyMutableBigStruct { 1: string msg1; 2: string msg2; @@ -571,4 +574,4 @@ struct MyMutableBigStruct { 255: string msg255; 256: string msg256; 257: string msg257; -} (java.swift.mutable = "true") +} diff --git a/exactprint/tests/fbthrift-tests/exceptions/src/module.thrift b/exactprint/tests/fbthrift-tests/exceptions/src/module.thrift index 4dcf6891..2ec487ad 100644 --- a/exactprint/tests/fbthrift-tests/exceptions/src/module.thrift +++ b/exactprint/tests/fbthrift-tests/exceptions/src/module.thrift @@ -20,28 +20,35 @@ namespace java.swift test.fixtures.exceptions +include "thrift/annotation/thrift.thrift" + transient server exception Fiery { + @thrift.ExceptionMessage 1: required string message; -} (message = "message") +} safe stateful exception Serious { + @thrift.ExceptionMessage 1: optional string sonnet; -} (message = "sonnet") +} client exception ComplexFieldNames { 1: string error_message; + @thrift.ExceptionMessage 2: string internal_error_message; -} (message = "internal_error_message") +} exception CustomFieldNames { 1: string error_message; + @thrift.ExceptionMessage 2: string internal_error_message (java.swift.name = "internalGreatMessage"); -} (message = "internal_error_message") +} exception ExceptionWithPrimitiveField { + @thrift.ExceptionMessage 1: string message; 2: i32 error_code; -} (message = "message") +} service Raiser { void doBland(); diff --git a/exactprint/tests/fbthrift-tests/mixin/src/module.thrift b/exactprint/tests/fbthrift-tests/mixin/src/module.thrift index a8f2f5b5..747bcc5d 100644 --- a/exactprint/tests/fbthrift-tests/mixin/src/module.thrift +++ b/exactprint/tests/fbthrift-tests/mixin/src/module.thrift @@ -38,6 +38,8 @@ typedef Mixin3Base Mixin3 struct Foo { 1: string field4; - 2: Mixin2 m2 (cpp.mixin); - 3: Mixin3 m3 (cpp.mixin); + @thrift.Mixin + 2: Mixin2 m2; + @thrift.Mixin + 3: Mixin3 m3; } diff --git a/exactprint/tests/fbthrift-tests/tablebased/src/module.thrift b/exactprint/tests/fbthrift-tests/tablebased/src/module.thrift index 34e55dc5..2a21251d 100644 --- a/exactprint/tests/fbthrift-tests/tablebased/src/module.thrift +++ b/exactprint/tests/fbthrift-tests/tablebased/src/module.thrift @@ -21,7 +21,10 @@ namespace cpp test.fixtures.tablebased namespace cpp2 test.fixtures.tablebased -typedef binary (cpp2.type = "std::unique_ptr") IOBufPtr +include "thrift/annotation/cpp.thrift" + +@cpp.Type{name = "std::unique_ptr"} +typedef binary IOBufPtr enum ExampleEnum { ZERO = 0, @@ -38,12 +41,18 @@ struct TrivialTypesStruct { struct ContainerStruct { 12: list fieldA; - 2: list (cpp.template = "std::list") fieldB; - 3: list (cpp.template = "std::deque") fieldC; - 4: list (cpp.template = "folly::fbvector") fieldD; - 5: list (cpp.template = "folly::small_vector") fieldE; - 6: set (cpp.template = "folly::sorted_vector_set") fieldF; - 7: map (cpp.template = "folly::sorted_vector_map") fieldG; + @cpp.Type{template = "std::list"} + 2: list fieldB; + @cpp.Type{template = "std::deque"} + 3: list fieldC; + @cpp.Type{template = "folly::fbvector"} + 4: list fieldD; + @cpp.Type{template = "folly::small_vector"} + 5: list fieldE; + @cpp.Type{template = "folly::sorted_vector_set"} + 6: set fieldF; + @cpp.Type{template = "folly::sorted_vector_map"} + 7: map fieldG; 8: list fieldH; }