mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-19 14:35:42 +00:00
Add --require-explicit-ids to require explicit ids (#6277)
* Add --require-explicit-ids to require explicit ids We just got bit by a well intentioned developer forgetting that field order by default is the field index. 3 people missed it in review. I'm looking at ways to make it harder to mess up. We are requesting that developers explicitly id all fields in tables. Automatic (opt in for others) enforcement of this will help the effort succeed. This patch adds a command line flag which lets the user require ids on all fields in tables. * Added docs to Compiler.md as well
This commit is contained in:
@@ -601,6 +601,9 @@ struct IDLOptions {
|
||||
|
||||
MiniReflect mini_reflect;
|
||||
|
||||
// If set, require all fields in a table to be explicitly numbered.
|
||||
bool require_explicit_ids;
|
||||
|
||||
// The corresponding language bit will be set if a language is included
|
||||
// for code generation.
|
||||
unsigned long lang_to_generate;
|
||||
@@ -661,6 +664,7 @@ struct IDLOptions {
|
||||
filename_extension(),
|
||||
lang(IDLOptions::kJava),
|
||||
mini_reflect(IDLOptions::kNone),
|
||||
require_explicit_ids(false),
|
||||
lang_to_generate(0),
|
||||
set_empty_strings_to_null(true),
|
||||
set_empty_vectors_to_null(true) {}
|
||||
|
||||
Reference in New Issue
Block a user