Fix instances in schema_parser.hpp that should use maybe*

This commit is contained in:
Daniel D'Avella 2018-08-28 14:46:36 -04:00
parent c2f22fddf5
commit d23f4047ed

View File

@ -1985,7 +1985,7 @@ private:
constraints::RequiredConstraint constraint;
for (const AdapterType v : node.getArray()) {
if (!v.isString()) {
if (!v.maybeString()) {
throw std::runtime_error("Expected required property name to "
"be a string value");
}
@ -2028,7 +2028,7 @@ private:
TypeConstraint constraint;
if (node.isString()) {
if (node.maybeString()) {
const TypeConstraint::JsonType type =
TypeConstraint::jsonTypeFromString(node.getString());
@ -2039,10 +2039,10 @@ private:
constraint.addNamedType(type);
} else if (node.isArray()) {
} else if (node.maybeArray()) {
int index = 0;
for (const AdapterType v : node.getArray()) {
if (v.isString()) {
if (v.maybeString()) {
const TypeConstraint::JsonType type =
TypeConstraint::jsonTypeFromString(v.getString());
@ -2054,7 +2054,7 @@ private:
constraint.addNamedType(type);
} else if (v.isObject() && version == kDraft3) {
} else if (v.maybeObject() && version == kDraft3) {
const std::string childPath = nodePath + "/" +
std::to_string(index);
const Subschema *subschema = makeOrReuseSchema<AdapterType>(
@ -2069,7 +2069,7 @@ private:
index++;
}
} else if (node.isObject() && version == kDraft3) {
} else if (node.maybeObject() && version == kDraft3) {
const Subschema *subschema = makeOrReuseSchema<AdapterType>(
rootSchema, rootNode, node, currentScope, nodePath,
fetchDoc, NULL, NULL, docCache, schemaCache);