thephpleague / json-guard

Validation of json-schema.org compliant schemas.
http://json-guard.thephpleague.com/
MIT License
175 stars 26 forks source link

Draft 6 support #114

Open matt-allan opened 7 years ago

matt-allan commented 7 years ago

This is already supported by the dereferencer.

We need a new rule set and constraints.

handrews commented 7 years ago

draft-06 is out!

Guide for core and validation Guide for hyper-schema

danballance commented 7 years ago

Hi, just reading this issue through. Does this mean I can validate (pretty simple) Draft 6 schemas with json-guard? PHP support for draft 6 looks non-existent atm and I need draft 6 for the "named enum" work around described here:

https://github.com/json-schema-org/json-schema-spec/issues/57

This issue looks promising. Anything I can do to help if this isn't already working out of the box?

handrews commented 7 years ago

@danballance in the meantime, you can always use a single-element enum in place of const as a further workaround. {"const": 42} is just shorthand for {"enum": [42]}. It's easier to read, and easier for tools to recognize as a special case for code or UI generation, but the validation effect is the same.

matt-allan commented 7 years ago

Hello,

Hi, just reading this issue through. Does this mean I can validate (pretty simple) Draft 6 schemas with json-guard?

Not yet. json-reference will mostly work with Draft 6 schemas (it supports $id) but this library doesn't support it yet.

Anything I can do to help if this isn't already working out of the box?

To support draft 6 we need a new rule set (see the docs for more info) and constraints for the changes in Draft 6. Most of the constraints can probably decorate the draft 4 version to add the new logic. The JSON Schema Test Suite will need to be updated to pull in the draft 6 tests (see composer.json) and you can use that to write the new rule set.

If you or someone else wants to tackle that let me know and I can answer any questions. I probably won't have time to do this myself anytime soon. I am planning on tackling #122 first since I need it for work.

danballance commented 7 years ago

@handrews yes that's what we are doing for now. Although I am seeing some other features in draft 6 that we could make use of.

@yuloh thanks for clarifying. I am considering trying to take this on as a weekend project, but I'm not free now until January 2018. I really would like to help with this. I'll see what I can organise in my home life and come back to you.

handrews commented 7 years ago

@danballance @yuloh Note that draft-07 is now nearing publication

philsturgeon commented 6 years ago

@yuloh ping Draft 7 is out!