Copying required field to union type vector (#4407)
* Eclipse ignore
* TypeScript support
* Prefixing enums
* Test results
* Merged JS and TS generators
* Fixed AppVeyor build problems
* Fixed more AppVeyor build problems
* Fixed more AppVeyor build problems
* Changed TS flag to options struct
* Storing options by value
* Removed unneeded const
* Re-export support for unions
* Uint support
* Casting bools to numbers for mutation
* TS shell tests
* Reverted generates js test file to original version
* Backing up js tests and properly generating test data
* Not importing flatbuffers for TS test generation
* Not overwriting generated js for tests
* AppVeyor test fixes
* Generating the most strict TS code possible
* Not returning null when creating vectors
* Not returning null from struct contructors
* Copying required field to union type vector
* Removed unneccessary bool
diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp
index fc3f97b..ade2041 100644
--- a/src/idl_parser.cpp
+++ b/src/idl_parser.cpp
@@ -745,6 +745,10 @@
}
if (typefield) {
+ if (!IsScalar(typefield->value.type.base_type)) {
+ // this is a union vector field
+ typefield->required = field->required;
+ }
// If this field is a union, and it has a manually assigned id,
// the automatically added type field should have an id as well (of N - 1).
auto attr = field->attributes.Lookup("id");