Closed
Description
Assume we have the following script (based on the documentation in the README):
require 'json-schema'
schema = {
"type" => "object",
"required" => ["a"],
"properties" => {
"a" => {"type" => "integer"}
}
}
data = {}
JSON::Validator.validate!(schema, data)
Running this results in the following output:
The property '#/' did not contain a required property of 'a' in schema 221df103-b050-5d5c-8ee8-aa1d185ac383# (JSON::Schema::ValidationError)
This error message doesn't seem to include the fragment for the "a" property correctly. If we specify an incorrect type on the other hand it is set properly:
require 'json-schema'
schema = {
"type" => "object",
"required" => ["a"],
"properties" => {
"a" => {"type" => "integer"}
}
}
data = {'a' => 'foo'}
JSON::Validator.validate!(schema, data)
Which results in:
The property '#/a' of type String did not match the following type: integer in schema 221df103-b050-5d5c-8ee8-aa1d185ac383# (JSON::Schema::ValidationError)
Metadata
Metadata
Assignees
Labels
No labels
Activity