Skip to content

Conversation

Avaq
Copy link

@Avaq Avaq commented Sep 12, 2025

The following schema demonstrates the issue:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$ref": "#/$defs/Json.Value",
  "$defs": {
    "Json.Value": {
      "anyOf": [
        { "$ref": "#/$defs/Json.Primitive" },
        { "$ref": "#/$defs/Json.Array" },
        { "$ref": "#/$defs/Json.Record" }
      ]
    },
    "Json.Primitive": {
      "anyOf": [
        { "type": "boolean" },
        { "type": "number" },
        { "type": "string" },
        { "type": "null" }
      ]
    },
    "Json.Array": {
      "type": "array",
      "items": { "$ref": "#/$defs/Json.Value" }
    },
    "Json.Record": {
      "type": "object",
      "required": [],
      "properties": {},
      "additionalProperties": { "$ref": "#/$defs/Json.Value" }
    }
  }
}

Save that to input.json, and run:

generate-schema-doc --no-link-to-reused-ref --config show_breadcrumbs=false input.json output.html

Before the proposed changes, this would lead to a RecursionError: maximum recursion depth exceeded. With the changes in place, the output.html generates as desired.

I also tested against the schema posted in #246, and it resolves the issue there, too.

The proposed fix was mainly the result of the analysis of an LLM, and didn't come from a place of personal understanding of the code. Caution advised while reviewing.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: RecursionError: maximum recursion depth exceeded

1 participant