• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// test schema file
2
3include "include_test1.fbs";
4
5namespace MyGame.Example2;
6
7table Monster {}  // Test having same name as below, but in different namespace.
8
9namespace MyGame.Example;
10
11attribute "priority";
12
13enum Color:byte (bit_flags) { Red = 0, Green, Blue = 3, }
14
15union Any { Monster, TestSimpleTableWithEnum, MyGame.Example2.Monster }
16
17struct Test { a:short; b:byte; }
18
19table TestSimpleTableWithEnum (csharp_partial) {
20  color: Color = Green;
21}
22
23struct Vec3 (force_align: 16) {
24  x:float;
25  y:float;
26  z:float;
27  test1:double;
28  test2:Color;
29  test3:Test;
30}
31
32table Stat {
33  id:string;
34  val:long;
35  count:ushort;
36}
37
38/// an example documentation comment: monster object
39table Monster {
40  pos:Vec3 (id: 0);
41  hp:short = 100 (id: 2);
42  mana:short = 150 (id: 1);
43  name:string (id: 3, required, key);
44  color:Color = Blue (id: 6);
45  inventory:[ubyte] (id: 5);
46  friendly:bool = false (deprecated, priority: 1, id: 4);
47  /// an example documentation comment: this will end up in the generated code
48  /// multiline too
49  testarrayoftables:[Monster] (id: 11);
50  testarrayofstring:[string] (id: 10);
51  testarrayofstring2:[string] (id: 28);
52  testarrayofbools:[bool] (id: 24);
53  enemy:MyGame.Example.Monster (id:12);  // Test referring by full namespace.
54  test:Any (id: 8);
55  test4:[Test] (id: 9);
56  testnestedflatbuffer:[ubyte] (id:13, nested_flatbuffer: "Monster");
57  testempty:Stat (id:14);
58  testbool:bool (id:15);
59  testhashs32_fnv1:int (id:16, hash:"fnv1_32");
60  testhashu32_fnv1:uint (id:17, hash:"fnv1_32");
61  testhashs64_fnv1:long (id:18, hash:"fnv1_64");
62  testhashu64_fnv1:ulong (id:19, hash:"fnv1_64");
63  testhashs32_fnv1a:int (id:20, hash:"fnv1a_32");
64  testhashu32_fnv1a:uint (id:21, hash:"fnv1a_32", cpp_type:"Stat");
65  testhashs64_fnv1a:long (id:22, hash:"fnv1a_64");
66  testhashu64_fnv1a:ulong (id:23, hash:"fnv1a_64");
67  testf:float = 3.14159 (id:25);
68  testf2:float = 3 (id:26);
69  testf3:float (id:27);
70}
71
72rpc_service MonsterStorage {
73  Store(Monster):Stat (streaming: "none");
74  Retrieve(Stat):Monster (streaming: "server", idempotent);
75}
76
77root_type Monster;
78
79file_identifier "MONS";
80file_extension "mon";
81