Unset FieldDef.optional if its key (#6402)

* Unset FieldDef.optional if its key

* removed StringKey table, just removed an extra "required, key"

* removed extra newline

Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
Casper
2021-01-12 14:06:43 -05:00
committed by GitHub
parent 7abe612b59
commit 8573108bbe
4 changed files with 177 additions and 178 deletions

View File

@@ -906,6 +906,7 @@ CheckedError Parser::ParseField(StructDef &struct_def) {
struct_def.has_key = true;
if (!IsScalar(type.base_type)) {
field->required = true;
field->optional = false;
if (type.base_type != BASE_TYPE_STRING)
return Error("'key' field must be string or scalar type");
}