Skip to content

Commit

Permalink
fbcode/common/
Browse files Browse the repository at this point in the history
Reviewed By: iahs

Differential Revision: D51329705

fbshipit-source-id: f07f33c49d1b9f72084861ff10265f450ce5c8bc
  • Loading branch information
generatedunixname226714639793621 authored and facebook-github-bot committed Nov 15, 2023
1 parent 354f86b commit 54ca720
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 22 deletions.
13 changes: 10 additions & 3 deletions exactprint/tests/fbthrift-tests/any/src/module.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
14 changes: 10 additions & 4 deletions exactprint/tests/fbthrift-tests/basic-swift-bean/src/module.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

namespace java.swift test.fixtures.basic_swift_bean

include "thrift/annotation/java.thrift"

enum MyEnum {
MyValue1 = 0,
MyValue2 = 1,
Expand All @@ -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;
Expand All @@ -59,17 +63,19 @@ struct MyStruct3 {
};
11: list<MyDataItem> myEmptyList = [];
12: map<i32, list<MyDataItem>> 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,
Expand Down
5 changes: 4 additions & 1 deletion exactprint/tests/fbthrift-tests/big-struct/src/module.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

namespace java.swift test.fixtures.basic

include "thrift/annotation/java.thrift"

struct MyNomralStruct {
1: string msg1;
2: string msg2;
Expand Down Expand Up @@ -313,6 +315,7 @@ struct MyBigStruct {
257: string msg257;
}

@java.Mutable
struct MyMutableBigStruct {
1: string msg1;
2: string msg2;
Expand Down Expand Up @@ -571,4 +574,4 @@ struct MyMutableBigStruct {
255: string msg255;
256: string msg256;
257: string msg257;
} (java.swift.mutable = "true")
}
17 changes: 12 additions & 5 deletions exactprint/tests/fbthrift-tests/exceptions/src/module.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 4 additions & 2 deletions exactprint/tests/fbthrift-tests/mixin/src/module.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
23 changes: 16 additions & 7 deletions exactprint/tests/fbthrift-tests/tablebased/src/module.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
namespace cpp test.fixtures.tablebased
namespace cpp2 test.fixtures.tablebased

typedef binary (cpp2.type = "std::unique_ptr<folly::IOBuf>") IOBufPtr
include "thrift/annotation/cpp.thrift"

@cpp.Type{name = "std::unique_ptr<folly::IOBuf>"}
typedef binary IOBufPtr

enum ExampleEnum {
ZERO = 0,
Expand All @@ -38,12 +41,18 @@ struct TrivialTypesStruct {

struct ContainerStruct {
12: list<i32> fieldA;
2: list<i32> (cpp.template = "std::list") fieldB;
3: list<i32> (cpp.template = "std::deque") fieldC;
4: list<i32> (cpp.template = "folly::fbvector") fieldD;
5: list<i32> (cpp.template = "folly::small_vector") fieldE;
6: set<i32> (cpp.template = "folly::sorted_vector_set") fieldF;
7: map<i32, string> (cpp.template = "folly::sorted_vector_map") fieldG;
@cpp.Type{template = "std::list"}
2: list<i32> fieldB;
@cpp.Type{template = "std::deque"}
3: list<i32> fieldC;
@cpp.Type{template = "folly::fbvector"}
4: list<i32> fieldD;
@cpp.Type{template = "folly::small_vector"}
5: list<i32> fieldE;
@cpp.Type{template = "folly::sorted_vector_set"}
6: set<i32> fieldF;
@cpp.Type{template = "folly::sorted_vector_map"}
7: map<i32, string> fieldG;
8: list<TrivialTypesStruct> fieldH;
}

Expand Down

0 comments on commit 54ca720

Please sign in to comment.