Require explicit IDs for flatbuffers
This will hopefully make it a lot harder for us to accidentally change
the binary schema.
Change-Id: Ied685f7b6872031c0ebf7426aeadd203e5f1eace
diff --git a/third_party/flatbuffers/reflection/reflection.fbs b/third_party/flatbuffers/reflection/reflection.fbs
index d9e2dc4..61d2f0c 100644
--- a/third_party/flatbuffers/reflection/reflection.fbs
+++ b/third_party/flatbuffers/reflection/reflection.fbs
@@ -31,84 +31,84 @@
}
table Type {
- base_type:BaseType;
- element:BaseType = None; // Only if base_type == Vector
- // or base_type == Array.
- index:int = -1; // If base_type == Object, index into "objects" below.
- // If base_type == Union, UnionType, or integral derived
- // from an enum, index into "enums" below.
- fixed_length:uint16 = 0; // Only if base_type == Array.
+ base_type:BaseType (id: 0);
+ element:BaseType = None (id: 1); // Only if base_type == Vector
+ // or base_type == Array.
+ index:int = -1 (id: 2); // If base_type == Object, index into "objects" below.
+ // If base_type == Union, UnionType, or integral derived
+ // from an enum, index into "enums" below.
+ fixed_length:uint16 = 0 (id: 3); // Only if base_type == Array.
}
table KeyValue {
- key:string (required, key);
- value:string;
+ key:string (required, key, id: 0);
+ value:string (id: 1);
}
table EnumVal {
- name:string (required);
- value:long (key);
- object:Object; // Will be deprecated in favor of union_type in the future.
- union_type:Type;
- documentation:[string];
+ name:string (required, id: 0);
+ value:long (key, id: 1);
+ object:Object (id: 2); // Will be deprecated in favor of union_type in the future.
+ union_type:Type (id: 3);
+ documentation:[string] (id: 4);
}
table Enum {
- name:string (required, key);
- values:[EnumVal] (required); // In order of their values.
- is_union:bool = false;
- underlying_type:Type (required);
- attributes:[KeyValue];
- documentation:[string];
+ name:string (required, key, id: 0);
+ values:[EnumVal] (required, id: 1); // In order of their values.
+ is_union:bool = false (id: 2);
+ underlying_type:Type (required, id: 3);
+ attributes:[KeyValue] (id: 4);
+ documentation:[string] (id: 5);
}
table Field {
- name:string (required, key);
- type:Type (required);
- id:ushort;
- offset:ushort; // Offset into the vtable for tables, or into the struct.
- default_integer:long = 0;
- default_real:double = 0.0;
- deprecated:bool = false;
- required:bool = false;
- key:bool = false;
- attributes:[KeyValue];
- documentation:[string];
- optional:bool = false;
+ name:string (required, key, id: 0);
+ type:Type (required, id: 1);
+ id:ushort (id: 2);
+ offset:ushort (id: 3); // Offset into the vtable for tables, or into the struct.
+ default_integer:long = 0 (id: 4);
+ default_real:double = 0.0 (id: 5);
+ deprecated:bool = false (id: 6);
+ required:bool = false (id: 7);
+ key:bool = false (id: 8);
+ attributes:[KeyValue] (id: 9);
+ documentation:[string] (id: 10);
+ optional:bool = false (id: 11);
}
table Object { // Used for both tables and structs.
- name:string (required, key);
- fields:[Field] (required); // Sorted.
- is_struct:bool = false;
- minalign:int;
- bytesize:int; // For structs.
- attributes:[KeyValue];
- documentation:[string];
+ name:string (required, key, id: 0);
+ fields:[Field] (required, id: 1); // Sorted.
+ is_struct:bool = false (id: 2);
+ minalign:int (id: 3);
+ bytesize:int (id: 4); // For structs.
+ attributes:[KeyValue] (id: 5);
+ documentation:[string] (id: 6);
}
table RPCCall {
- name:string (required, key);
- request:Object (required); // must be a table (not a struct)
- response:Object (required); // must be a table (not a struct)
- attributes:[KeyValue];
- documentation:[string];
+ name:string (required, key, id: 0);
+ request:Object (required, id: 1); // must be a table (not a struct)
+ response:Object (required, id: 2); // must be a table (not a struct)
+ attributes:[KeyValue] (id: 3);
+ documentation:[string] (id: 4);
}
table Service {
- name:string (required, key);
- calls:[RPCCall];
- attributes:[KeyValue];
- documentation:[string];
+ name:string (required, key, id: 0);
+ calls:[RPCCall] (id: 1);
+ attributes:[KeyValue] (id: 2);
+ documentation:[string] (id: 3);
}
table Schema {
- objects:[Object] (required); // Sorted.
- enums:[Enum] (required); // Sorted.
- file_ident:string;
- file_ext:string;
- root_table:Object;
- services:[Service]; // Sorted.
+ objects:[Object] (required, id: 0); // Sorted.
+ enums:[Enum] (required, id: 1); // Sorted.
+ file_ident:string (id: 2);
+ file_ext:string (id: 3);
+ root_table:Object (id: 4);
+ services:[Service] (id: 5); // Sorted.
}
root_type Schema;