# Recursive schema error

**URL:** <https://jsonforms.discourse.group/t/recursive-schema-error/2746>\
**Category:** General\
**Created:** [July 22, 2025, 12:32pm UTC](https://jsonforms.discourse.group/t/recursive-schema-error/2746 "2025-07-22T12:32:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![artishock](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@artishock](https://jsonforms.discourse.group/u/artishock)\
**Post date:** [July 22, 2025, 12:32pm UTC](https://jsonforms.discourse.group/t/recursive-schema-error/2746/1 "2025-07-22T12:32:08Z")

</div>

Hi!  
When having the simplest schema that has recursive ref inside I get:  
ERROR  
Maximum call stack size exceeded RangeError: Maximum call stack size exceeded

```auto

const schema : {
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "http://smth.com/schema/site-0.12.0.schema.json",
  "title": "Site Model",
  "description": "Model of site power monitoring configuration",
  "type": "object",
  "$ref": "#/definitions/site",
  "definitions": {
    "site": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string"
        },
        "children": {
          "type": "array",
          "items": {
            "$ref": "#"
          }
        }
      }
    }
  }
}

```

```auto
uiSchema:
  const uiSchema = {
    type: 'VerticalLayout',
    elements: [
      {
        type: 'Control',
        label: 'Site Title',
        scope: '#/properties/title', // Points to the 'title' property within the 'site' object
      },
      {
        type: 'Control',
        label: 'Children',
        scope: '#/properties/children', // Points to the 'children' array
      },
    ],
  };

```

```auto
   <JsonForms
        schema={schema}
        uischema={uiSchema}
        data={{}}
        renderers={vanillaRenderers} // Use material renderers
        cells={vanillaCells} // Use material cells
        onChange={({ data }) => setData(data)} // Update state on form changes
      />

```

same issue with materialRenderers and Cells

```
"@jsonforms/material-renderers": "^3.6.0",
"@jsonforms/react": "^3.6.0",
"@jsonforms/vanilla-renderers": "^3.6.0",

```

how can i solve this?

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [July 22, 2025, 1:29pm UTC](https://jsonforms.discourse.group/t/recursive-schema-error/2746/2 "2025-07-22T13:29:55Z")

</div>

Hi @artishock,

This is a bug in JSON Forms. The issue happens when the root of the `schema` uses a `$ref` itself. The code does not properly handle the case and just restarts the resolving endlessly.

Until this is fixed you need to restructure the JSON Schema to not use a root level `$ref`, e.g.

```auto
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "http://smth.com/schema/site-0.12.0.schema.json",
  "title": "Site Model",
  "description": "Model of site power monitoring configuration",
  "type": "object",
  "properties": {
    "title": {
      "type": "string"
    },
    "children": {
      "type": "array",
      "items": {
        "$ref": "#"
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![artishock](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@artishock](https://jsonforms.discourse.group/u/artishock)\
**Post date:** [July 23, 2025, 6:35am UTC](https://jsonforms.discourse.group/t/recursive-schema-error/2746/3 "2025-07-23T06:35:19Z")

</div>

Thanks for the quick reply.  
Is it known when approximately it is going to be fixed? Or it is not in priority now?

---

<div class="post-metadata">

**Author:** ![sdirix](https://yyz2.discourse-cdn.com/free1/user_avatar/jsonforms.discourse.group/sdirix/32/1073_2.png) [@sdirix](https://jsonforms.discourse.group/u/sdirix)\
**Post date:** [July 23, 2025, 11:35am UTC](https://jsonforms.discourse.group/t/recursive-schema-error/2746/4 "2025-07-23T11:35:34Z")

</div>

I reported the bug: [#2471](https://github.com/eclipsesource/jsonforms/issues/2471). I planned it in for the next minor/patch version.
