Closed mkaut closed 1 year ago
Are you passing the String
"{}"
? JSONSchema.jl operates on parsed JSON data, not the string representation. Perhaps we should make this clearer with an error, or use JSON.parse
on string input.
julia> schema = JSONSchema.Schema(raw"""
{
"$schema": "http://json-schema.org/draft-06/schema",
"type": "object",
"properties": {
"id": {
"type": "integer"
}
}
}
""")
A JSONSchema
julia> data = "{}"
"{}"
julia> JSONSchema.validate(schema, data)
Validation failed:
path: top-level
instance: {}
schema key: type
schema value: object
julia> JSONSchema.validate(schema, JSONSchema.JSON.parse(data))
Thanks a lot, that was stupid of me - should have noticed that.
Validation fails for any example I try, with the same result:
except that
instance
obviously varies with the tested data.The above is from schema:
and data =
{}
, but I get the same error whatever I try.I use it as follows:
Julia 1.9 on Windows, JSONSchema 1.1, JSON 0.21.4.