-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support if-then-else #37 #53
Conversation
…into fredo-dedup-master # Conflicts: # Project.toml # src/schema.jl # test/runtests.jl
Can you revert the JSONPointer stuff? Let's keep these PRs separate. |
return val_else | ||
end | ||
return nothing | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might have made a mistake, but I think you can write this code as:
function _if_then_else(x, schema, path)
if _validate(x, schema["if"], path) !== nothing
if haskey(schema, "else")
return _validate(x, schema["else"], path)
end
elseif haskey(schema, "then")
return _validate(x, schema["then"], path)
end
return
end
but what about the case where you have a if-then
and the if
fails to validate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, assuming tests pass.
We don't seem to have coverage, so I just want to double check that these are actually getting tested |
https://json-schema.org/understanding-json-schema/reference/conditionals#ifthenelse
I've updated _validate to work on
if
,then
,else
and it passed all tests fromdraft7
folder within theJSON-Schema-Test-Suite
I've thought about making a separate pull request from #52
But this pull request includes #52😓, you can close #52 and only merge this PR