playlyfe / themis

A blazing fast JSON Schema v4 validator!
Other
60 stars 7 forks source link

I have themis failing some tests in the officila JSON-schema test suite #10

Open ebdrup opened 9 years ago

ebdrup commented 9 years ago

You asked me to report any tests failing in https://github.com/pandastrike/jsck/issues/81#issuecomment-72329277 This discussion belongs here. The tests that I find themis failing are listed here: https://github.com/Muscula/json-schema-benchmark/blob/master/reports/themis.md

This may be due to the way themis is instantiated here: https://github.com/Muscula/json-schema-benchmark/blob/master/index.js#L37

@Prestaul added the comment $refs only supported if they have id attributes and the test suite refs do not

What's needed to make themis pass the tests?

atrniv commented 9 years ago

All these tests include remotely accessed references. Currently themis does not automatically fetch remote references. However if you have already fetched the remote references, you can inject them into themis while creating the validator by passing them all in an array. I've given an example of the same in the readme.

However themis expects the remote reference schema to contain an id which tells the location from where the schema was fetched. Otherwise it will assign an integer id to it and then the tests would fail.

I'm not sure what would be the best way to fix this issue. I'll have to think about it for a while.

Prestaul commented 9 years ago

I honestly think this would require a change to the library so that we can provide a uri that is not specified in the document as an id. Probably not a huge update!