mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-09 06:30:54 +00:00
Added --defaults-json to output fields at default value.
Normal behavior is to not output fields that happen to have the default value, since those will be reproduced anyway when turned into a FlatBuffer binary. This however can be problematic when using JSON to interop with other system since they might not know this default value. This flatc option (and also flag to GenerateText) will force those fields to be output anyway. Tested: on Linux.
This commit is contained in:
@@ -400,6 +400,7 @@ extern void GenComment(const std::vector<std::string> &dc,
|
||||
// Container of options that may apply to any of the source/text generators.
|
||||
struct GeneratorOptions {
|
||||
bool strict_json;
|
||||
bool output_default_scalars_in_json;
|
||||
int indent_step;
|
||||
bool output_enum_identifiers;
|
||||
bool prefixed_enums;
|
||||
@@ -411,7 +412,9 @@ struct GeneratorOptions {
|
||||
|
||||
Language lang;
|
||||
|
||||
GeneratorOptions() : strict_json(false), indent_step(2),
|
||||
GeneratorOptions() : strict_json(false),
|
||||
output_default_scalars_in_json(false),
|
||||
indent_step(2),
|
||||
output_enum_identifiers(true), prefixed_enums(true),
|
||||
include_dependence_headers(false),
|
||||
mutable_buffer(false),
|
||||
|
||||
Reference in New Issue
Block a user