Skip to content

Exception thrown while using recursive schema definition #452

@b1r3k

Description

@b1r3k

Prerequisites

  • I have read the documentation;
  • In the case of a bug report, I understand that providing a SSCCE example is tremendously useful to the maintainers.

Description

Current implementation is not able to handle recursive schema

Steps to Reproduce

  1. Make recursive schema like this:
{
    "definitions": {
        "TPNode": {
            "title": "TPNode",
            "description": "TPNode",
            "type": "object",
            "properties": {
                "name": { "type": "string" },
                "children": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/TPNode"
                    }
                }
            }
        }
    },
    "$ref": "#/definitions/TPNode"
}
  1. Try to render

See fiddle: https://jsfiddle.net/b1r3k/dssabb76/2/

Expected behavior

Form should be rendered according to valid schema as done for example here

Actual behavior

RangeError exception is being thrown

RangeError: Maximum call stack size exceeded
toIdSchema
webpack:///./~/react-jsonschema-form/lib/utils.js?:475:18
toIdSchema
webpack:///./~/react-jsonschema-form/lib/utils.js?:483:12
toIdSchema
webpack:///./~/react-jsonschema-form/lib/utils.js?:491:22
toIdSchema
webpack:///./~/react-jsonschema-form/lib/utils.js?:480:12
toIdSchema
webpack:///./~/react-jsonschema-form/lib/utils.js?:483:12
toIdSchema
webpack:///./~/react-jsonschema-form/lib/utils.js?:491:22

Version

Current release (0.41.2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions