json-schema icon indicating copy to clipboard operation
json-schema copied to clipboard

Attribute uniqueItem: false should not trigger validation

Open hfabre opened this issue 2 years ago • 0 comments

Hi, I encounter a problem with json-schema. Given the following spec:

require "json-schema"

schema = {
  "type" => "object",
  "required" => ["target"],
  "properties" => {
    "target" => {
      "type" => "array",
      "items" => {},
      "uniqueItems" => false,
    }
  }
}

data = { "target" => [1, 1] }

JSON::Validator.fully_validate(schema, data)
# => ["The property '#/target' contained duplicated array values in schema 4d32e7eb-0393-5de4-81f2-37eecb8cc064"]

In my opinion and according to the json schema spec, it should validate only if set to true.

hfabre avatar Nov 04 '21 11:11 hfabre