json-schema-for-humans icon indicating copy to clipboard operation
json-schema-for-humans copied to clipboard

Information missing in circular refs

Open gerrycampion opened this issue 2 years ago • 3 comments

Here is an example json schema with a circular ref:

{
  "$defs": {
    "node": {
      "oneOf": [
        {
          "$ref": "#/$defs/internal"
        },
        {
          "const": "I am a leaf"
        }
      ]
    },
    "internal": {
      "items": [
        {
          "$ref": "#/$defs/node"
        }
      ],
      "type": "array"
    }
  },
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "Node": {
      "$ref": "#/$defs/node"
    }
  },
  "type": "object"
}

I generate the schema html using js template and no other options. When I generate the schema html, I don't see any information about the original anchor node that is referenced. Note for example, there is no way to see the "I am a leaf" const. Here is a screenshot of the fully expanded html doc:

image

The generated html

gerrycampion avatar Oct 05 '22 16:10 gerrycampion

Very interested in this fix as we are unable to visualize any more recent JSON schemas where this practice is quite common when dealing with large schemas that reuse definitions for simplification and extensibility.

mrutkows avatar May 03 '23 19:05 mrutkows

Also interested in this. I've been subscribed to the bug for about a year. I've tried setting link_to_reused_ref=true, but still no success. Are there any alternative JSON schema documentation generators that can handle it, while still producing reasonably navigable output?

arghness avatar Nov 10 '23 15:11 arghness

@arghness atlassian-labs json-schema-viewer seemed like a solid contender, but didn't support const last time I checked: https://github.com/atlassian-labs/json-schema-viewer/issues/38 That was also a dealbreaker, so I've given up for now.

gerrycampion avatar Nov 10 '23 16:11 gerrycampion