voxpupuli / json-schema

Ruby JSON Schema Validator
MIT License
1.52k stars 242 forks source link

Support for "http://json-schema.org/schema"? #396

Open josvazg opened 6 years ago

josvazg commented 6 years ago

Using json-schema to validate Azure UI Templates (sample for version 0.1.2-preview) they use URL http://json-schema.org/schema as metaschema, but json-schema fails to use it as it is not preloaded.

As a workaround I do this, as it seems that URL is just draft 6 right now:

      AZURE_BASE_METASCHEMA="http://json-schema.org/schema#"
      ...
      default_draft6 = JSON::Validator.validator_for_name("draft6").clone
      default_draft6.uri = URI(AZURE_BASE_METASCHEMA)
      default_draft6.names = [AZURE_BASE_METASCHEMA]
      JSON::Validator.register_validator(default_draft6)

Which works fine so far.

Is it possible to have json-schema support that URL directly out of the box without my above trick?

iainbeeston commented 6 years ago

Can you please try #388 and tell me if that works for you?

iainbeeston commented 6 years ago

But please bear in mind that draft06 support is very basic at present

josvazg commented 6 years ago

Well, will try but #388 seems to be about: http://json-schema.org/draft/schema# While this is about: http://json-schema.org/schema#

Which also makes me think to be that "draft 6 "is not only no longer a draft, but the default json-schema to use. But haven't double checked it.