Skip to content

Commit cd3c73b

Browse files
author
Owen Swerkstrom
committed
fixed "required" schema handling. thanks toleressea!
1 parent 82083fe commit cd3c73b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/wjelement/schema.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -852,20 +852,18 @@ static XplBool SchemaValidate(WJElement schema, WJElement document,
852852
if(fail && err) {
853853
err(client, "required item '%s' not found.", name);
854854
}
855-
} else if(version >= 4 && memb->type == WJR_TYPE_ARRAY) {
855+
} else if(memb->type == WJR_TYPE_ARRAY) {
856856
/* draft 4; "required": [ "prop1", "prop2" ] */
857857
arr = NULL;
858858
while((arr = WJEGet(memb, "[]", arr))) {
859-
MemAsprintf(&str, "[\"%s\"]",
860-
WJEString(arr, NULL, WJE_GET, ""));
861-
if(document && !WJEGet(document, str, NULL)) {
859+
str = WJEString(arr, NULL, WJE_GET, "");
860+
if(document && !WJEChild(document, str, WJE_GET)) {
862861
fail = TRUE;
863862
if(fail && err) {
864863
err(client, "%s: required member '%s' not found.",
865864
name, str);
866865
}
867866
}
868-
MemRelease(&str);
869867
}
870868
}
871869
anyFail = anyFail || fail;

0 commit comments

Comments
 (0)