diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index fc3f97b59..ade20413d 100644 --- a/src/idl_parser.cpp +++ b/src/idl_parser.cpp @@ -745,6 +745,10 @@ CheckedError Parser::ParseField(StructDef &struct_def) { } 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");