Skip to content

Commit

Permalink
fbcode/thrift/lib/cpp2/
Browse files Browse the repository at this point in the history
Reviewed By: dtolnay

Differential Revision: D68432380

fbshipit-source-id: 2b30edcf76effe915e651a0656306d553100863f
  • Loading branch information
generatedunixname226714639793621 authored and facebook-github-bot committed Jan 21, 2025
1 parent c0ca1cd commit d45a9f1
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 20 deletions.
36 changes: 24 additions & 12 deletions thrift/lib/cpp2/reflection/demo/annotated.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,35 @@

namespace cpp2 static_reflection.demo

include "thrift/annotation/thrift.thrift"

@thrift.DeprecatedUnvalidatedAnnotations{
items = {
"description": "example of an annotated enum",
"purpose": "toy example of enum annotations",
},
}
enum annotated_enum {
field0 = 0,
field1 = 1,
field2 = 2,
} (
description = "example of an annotated enum",
purpose = "toy example of enum annotations",
)
}

@thrift.DeprecatedUnvalidatedAnnotations{
items = {
"description": "example of an annotated struct",
"purpose": "toy example of struct annotations",
},
}
struct annotated_struct {
1: i32 i32_data (description = "example of an annotated struct member");
@thrift.DeprecatedUnvalidatedAnnotations{
items = {"description": "example of an annotated struct member"},
}
1: i32 i32_data;
2: i16 i16_data;
3: double double_data;
4: string string_data (
description = "example of a fourth annotated struct member",
);
} (
description = "example of an annotated struct",
purpose = "toy example of struct annotations",
)
@thrift.DeprecatedUnvalidatedAnnotations{
items = {"description": "example of a fourth annotated struct member"},
}
4: string string_data;
}
36 changes: 28 additions & 8 deletions thrift/lib/cpp2/reflection/demo/flat_config.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,35 @@

namespace cpp2 static_reflection.demo

include "thrift/annotation/thrift.thrift"

struct flat_config {
1: string host_name (property = "host-name");
2: i16 host_port (property = "host-port");
3: string client_name (property = "client-name");
4: i32 send_timeout (property = "socket-send-timeout");
5: i32 receive_timeout (property = "socket-receive-timeout");
6: i32 frame_size (property = "transport-frame-size");
7: bool compress (property = "apply-compression");
8: double log_rate (property = "log-sampling-rate");
@thrift.DeprecatedUnvalidatedAnnotations{items = {"property": "host-name"}}
1: string host_name;
@thrift.DeprecatedUnvalidatedAnnotations{items = {"property": "host-port"}}
2: i16 host_port;
@thrift.DeprecatedUnvalidatedAnnotations{items = {"property": "client-name"}}
3: string client_name;
@thrift.DeprecatedUnvalidatedAnnotations{
items = {"property": "socket-send-timeout"},
}
4: i32 send_timeout;
@thrift.DeprecatedUnvalidatedAnnotations{
items = {"property": "socket-receive-timeout"},
}
5: i32 receive_timeout;
@thrift.DeprecatedUnvalidatedAnnotations{
items = {"property": "transport-frame-size"},
}
6: i32 frame_size;
@thrift.DeprecatedUnvalidatedAnnotations{
items = {"property": "apply-compression"},
}
7: bool compress;
@thrift.DeprecatedUnvalidatedAnnotations{
items = {"property": "log-sampling-rate"},
}
8: double log_rate;
}

const flat_config example = {
Expand Down

0 comments on commit d45a9f1

Please sign in to comment.