brandur / json_schema

A JSON Schema V4 and Hyperschema V4 parser and validator.
MIT License
230 stars 45 forks source link

additionalItems can be object #61

Closed okitan closed 8 years ago

okitan commented 8 years ago

See: https://github.com/okitan/json_schema/blob/master/schemas/schema.json#L70-L76

brandur commented 8 years ago

@okitan Nice catch! Thanks :)

The one problem is that I don't think that the validator is going to handle the object properly as is currently written.

okitan commented 8 years ago

I guess the validator works fine, because additional_items works only when its value is false.

https://github.com/brandur/json_schema/blob/master/lib/json_schema/validator.rb#L242

brandur commented 8 years ago

I guess the validator works fine, because additional_items works only when its value is false.

Oh right. But I meant that I don't think it'll do the right thing when additionalItems is a schema. Is that your reading as well?

okitan commented 8 years ago

Sure, what I meant is the current behavior of this gem is as per spec.

http://json-schema.org/latest/json-schema-validation.html#anchor37

if the value of "additionalItems" is boolean value true or an object, validation of the instance always succeeds;

brandur commented 8 years ago

@okitan Oh what?! So am I reading this right in that an additionalItems that's a schema basically just does the same as a boolean true value? Nice catch :)

Alright, going to pull this in then! Thanks.

brandur commented 8 years ago

Released as 0.12.4.

okitan commented 8 years ago

Thanks!