jsonschema2md icon indicating copy to clipboard operation
jsonschema2md copied to clipboard

Dereference schemas

Open carlo-quinonez opened this issue 6 years ago • 1 comments

I encountered an issue when I used my custom metaschema that uses the "allOf" keyword to extend the base JSON Schema draft.

{
  "$schema": "http://json-schema.org/schema",
  "$id": "https://schemas.tf/json/metaschema/1-0-0",
  "title": "Core schema meta-schema",
  "allOf": [
    {
      "properties": {
        "tfs_custom_prop": {
          "type": "boolean",
          "default": false
        }, 
        // more custom keywords
      }
    },
    {
      "$ref": "http://json-schema.org/draft/2019-09/schema#"
    }
  ]
}

However, jsonschema2md fails to handle the external reference to http://json-schema.org/draft/2019-09/schema# and throws an error

[ERROR] { Error: can't resolve reference http://json-schema.org/draft/2019-09/schema# from id https://schemas.tf/json/metaschema/1-0-0#
    (No stack trace)

I can work around this by dereferencing my metaschema before using it with jsonschema2md but it would be ideal if jsonschema2md had an option to enable deferencing.

Would you accept a PR for this enhancement?

carlo-quinonez avatar Oct 30 '19 19:10 carlo-quinonez

I definitely would! This has been on my mental wishlist for a long time, I just always found workarounds ;)

trieloff avatar Nov 04 '19 08:11 trieloff