-
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 latest draft version #37
Comments
How is this going? According to the JSON schema people the 2023 draft is not far from being released and it will probably be the first release version. |
No progress. I think the blocker was a new release of the test suite: https://github.com/json-schema-org/JSON-Schema-Test-Suite The last tag was 2.0.0: https://github.com/json-schema-org/JSON-Schema-Test-Suite/releases/tag/2.0.0 I guess we could try getting from |
It seems to be officially released in Zenodo under the DOI: 10.5281/zenodo.6973515 (https://zenodo.org/record/6973515). In the meanwhile I opened an issue there (json-schema-org/JSON-Schema-Test-Suite#672) |
They made a new release (https://github.com/json-schema-org/JSON-Schema-Test-Suite/releases) and according to the linked issue (json-schema-org/JSON-Schema-Test-Suite#672) master should be always stable and usable by everyone. |
Thanks for following up with them. I have no plans to work on this, but I can review a PR if you're interested. The test suite gets downloaded JSONSchema.jl/test/runtests.jl Line 14 in d7f6d39
all of the checks are in https://github.com/fredo-dedup/JSONSchema.jl/blob/master/src/validation.jl I assume it's a matter of hooking up the new tests, seeing what fails, and then poking away at updating the |
I addressed some but not all of this in #57 |
I fixed a bunch of things in #57 and #59, but there are still a couple of issues: JSONSchema.jl/test/runtests.jl Lines 138 to 144 in 468375a
JSONSchema.jl/test/runtests.jl Lines 147 to 152 in 468375a
I've just been playing whack-a-mole with the Here's a simpler script to get started if someone is interested in debugging the outstanding case(s): using Test
using HTTP
import JSON
using JSONSchema
import Downloads
import ZipFile
const TEST_SUITE_URL = "https://github.com/json-schema-org/JSON-Schema-Test-Suite/archive/23.1.0.zip"
const SCHEMA_TEST_DIR = let
dest_dir = mktempdir()
dest_file = joinpath(dest_dir, "test-suite.zip")
Downloads.download(TEST_SUITE_URL, dest_file)
for f in ZipFile.Reader(dest_file).files
filename = joinpath(dest_dir, "test-suite", f.name)
if endswith(filename, "/")
mkpath(filename)
else
write(filename, read(f, String))
end
end
joinpath(dest_dir, "test-suite", "JSON-Schema-Test-Suite-23.1.0", "tests")
end
GLOBAL_TEST_DIR = Ref{String}("")
server = HTTP.Sockets.listen(HTTP.ip"127.0.0.1", 1234)
HTTP.serve!("127.0.0.1", 1234; server = server) do req
# Make sure to strip first character (`/`) from the target, otherwise it
# will infer as a file in the root directory.
file = joinpath(GLOBAL_TEST_DIR[], "../../remotes", req.target[2:end])
return HTTP.Response(200, read(file, String))
end
GLOBAL_TEST_DIR[] = joinpath(SCHEMA_TEST_DIR, "draft7")
schema = JSON.parse(raw"""{
"$id": "http://localhost:1234/some-id",
"properties": {
"name": {"$ref": "nested/foo-ref-string.json"}
}
}""")
id_map = JSONSchema.build_id_map(schema)
JSONSchema.resolve_refs!(schema, JSONSchema.URIs.URI(), id_map, abspath("."))
JSONSchema.validate(Dict("foo" => "a"), JSONSchema.Schema(schema)) === nothing
JSONSchema.validate(Dict("foo" => 1), JSONSchema.Schema(schema)) !== nothing |
We currently implement draft-6, but things have moved on since. We should make updates as necessary.
The text was updated successfully, but these errors were encountered: