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

Draft 6 support

Open matt-allan opened this issue 8 years ago • 7 comments

This is already supported by the dereferencer.

We need a new rule set and constraints.

matt-allan avatar Apr 24 '17 01:04 matt-allan

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?

danballance avatar Oct 17 '17 11:10 danballance

@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.

handrews avatar Oct 17 '17 16:10 handrews

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.

matt-allan avatar Oct 17 '17 17:10 matt-allan

@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.

danballance avatar Nov 02 '17 12:11 danballance

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

handrews avatar Nov 02 '17 15:11 handrews

@yuloh ping Draft 7 is out!

philsturgeon avatar Dec 21 '17 18:12 philsturgeon