|
@@ -1362,11 +1362,11 @@ JSONValidationResult* JSONValidator::validate(
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ XML::Editor tmp = zConstraints->selectChildsByAttribute(
|
|
|
+ "name", i.val());
|
|
|
JSONValidationResult* res = validateMultipleTypes(
|
|
|
zValue->asObject()->zValue(i.val()),
|
|
|
- zConstraints->selectChildsByAttribute("name", i.val())
|
|
|
- .begin()
|
|
|
- .val(),
|
|
|
+ tmp.begin().val(),
|
|
|
p);
|
|
|
if (!res->isValid())
|
|
|
{
|
|
@@ -1384,6 +1384,7 @@ JSONValidationResult* JSONValidator::validate(
|
|
|
if (!zValue->asObject()->hasValue(
|
|
|
constraint->getAttributeValue("name")))
|
|
|
{
|
|
|
+ XML::Editor tmp = constraint->selectChildren();
|
|
|
Text p = path;
|
|
|
p += ".";
|
|
|
p += constraint->getAttributeValue("name");
|
|
@@ -1392,17 +1393,13 @@ JSONValidationResult* JSONValidator::validate(
|
|
|
dynamic_cast<JSONValue*>(zValue->getThis()),
|
|
|
dynamic_cast<XML::Element*>(
|
|
|
zConstraints->getThis()),
|
|
|
- new JSONMissingOneOf(
|
|
|
- p, constraint->selectChildren()));
|
|
|
+ new JSONMissingOneOf(p, tmp));
|
|
|
return new JSONTypeMissmatch(path,
|
|
|
dynamic_cast<JSONValue*>(zValue->getThis()),
|
|
|
dynamic_cast<XML::Element*>(zConstraints->getThis()),
|
|
|
new JSONMissingValue(p,
|
|
|
dynamic_cast<XML::Element*>(
|
|
|
- constraint->selectChildren()
|
|
|
- .begin()
|
|
|
- .val()
|
|
|
- ->getThis())));
|
|
|
+ tmp.begin()->getThis())));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1418,9 +1415,12 @@ JSONValidationResult* JSONValidator::validateMultipleTypes(
|
|
|
Text childPath) const
|
|
|
{
|
|
|
if (zPossibleChildConstraints->getChildCount() == 1)
|
|
|
+ {
|
|
|
+ XML::Editor children = zPossibleChildConstraints->selectChildren();
|
|
|
return validate(zChildValue,
|
|
|
- zPossibleChildConstraints->selectChildren().begin().val(),
|
|
|
+ children.begin().val(),
|
|
|
childPath);
|
|
|
+ }
|
|
|
bool hasTypeAttr = 0;
|
|
|
RCArray<XML::Element> possibleConstraints;
|
|
|
if (zPossibleChildConstraints->hasAttribute("typeSpecifiedBy"))
|
|
@@ -1437,10 +1437,10 @@ JSONValidationResult* JSONValidator::validateMultipleTypes(
|
|
|
zPossibleChildConstraints->selectChildsByName("object")
|
|
|
.whereChildWithAttributeExists("name", typeAttr))
|
|
|
{
|
|
|
+ XML::Editor nameChildren
|
|
|
+ = constraint->selectChildsByAttribute("name", typeAttr);
|
|
|
XML::Element* typeAttrContraints
|
|
|
- = constraint->selectChildsByAttribute("name", typeAttr)
|
|
|
- .begin()
|
|
|
- .val();
|
|
|
+ = nameChildren.begin().val();
|
|
|
JSONValidationResult* res = validateMultipleTypes(
|
|
|
typeV, typeAttrContraints, childPath + "." + typeAttr);
|
|
|
if (res->isValid())
|