idl_parser.cpp ignores $schema in input json (#4382)

* idl_parser.cpp ignores $schema in input json
#4381

* idl_parser.cpp: Fixed ci error signed unsigned comparison

* idl_parser.cpp: replaced case insensitive search for $schema with case sensitive search

* idl_parser.cpp: Expecting a string constant after $schema
#4382
This commit is contained in:
schoetbi 2017-07-19 17:58:48 +02:00 committed by Wouter van Oortmerssen
parent 625c989875
commit 2e2063cbeb
1 changed files with 4 additions and 0 deletions

View File

@ -914,6 +914,10 @@ CheckedError Parser::ParseTable(const StructDef &struct_def, std::string *value,
size_t fieldn = 0;
auto err = ParseTableDelimiters(fieldn, &struct_def,
[&](const std::string &name) -> CheckedError {
if (name == "$schema") {
EXPECT(kTokenStringConstant);
return NoError();
}
auto field = struct_def.fields.Lookup(name);
if (!field) {
if (!opts.skip_unexpected_fields_in_json) {