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

JSON::Validator.validate throws TypeError exception class/object expected

Open chibeepatag opened this issue 1 year ago • 2 comments

I'm using ruby 2.7.1 and rails 6.1 When validating the following json against the following schema, JSON::Validator.validate throws TypeError exception class/object JSON: [ { "name": "enable_customer_membership", "value": null }, { "name": "time_zone", "value": "Guam" }, { "name": "company_name", "value": "Demeter Trading Inc." }, ]

Schema: { "id": "https://celine.com/v1/setting.schema.json", "title" : "Setting", "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string", "description": "name of setting" }, "value": { "anyOf": [ { "type": "number" }, { "type": "null" }, { "type": "string" }, { "type": "integer" }, { "type": "boolean" } ] } }, "required": [ "name", "value" ] } }

chibeepatag avatar Mar 10 '23 07:03 chibeepatag

We encountered this today in our project -- it seems closely connected to a change in Spring, from v4.0.0 to v4.1.1: https://github.com/rails/spring/commit/21e272f73efc75e9f273277fd74fed3ef86ce1eb. Is it possible you have a new version of Spring, and is it possible that downgrading will "resolve" this bug? If so, then it's a bug on Spring...

blerner avatar May 06 '23 17:05 blerner

am facing this issue as well. downgrading to 4.1.0 works. not sure how spring is causing validate! to fail...

Physium avatar Jul 03 '23 09:07 Physium