Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown while using recursive schema definition #452

Closed
2 tasks done
b1r3k opened this issue Jan 27, 2017 · 2 comments
Closed
2 tasks done

Exception thrown while using recursive schema definition #452

b1r3k opened this issue Jan 27, 2017 · 2 comments

Comments

@b1r3k
Copy link

b1r3k commented Jan 27, 2017

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)

@n1k0 n1k0 closed this as completed in 6f6a6d9 Jan 27, 2017
n1k0 added a commit that referenced this issue Jan 28, 2017
Breaking changes

When a text input is emptied by the user, it's value is now reset to `undefined` instead of being set to `""` (empty string) as previously. This better matches traditional HTML forms behavior.

New features

* Add an array field template component (#437)
* Wrap radio and checkbox labels into span to enable styling. (#428)
* Reset text inputs value when emptied (#442)
* Add transform hook for changing errors from json schema validation (#432)
* Add a noHtml5Validate prop (#448)
* Add support for a onBlur event handler (#431)
* Allow empty option for enum fields (#451)

Bugfixes

* Fix #452: Support recursively referenced definitions. (#453)
* Fix #454: Document what master actually is, suffix its version with -dev.
@gpietro
Copy link

gpietro commented Jan 21, 2018

I still have this problem with version 1.0.0.

{
  "title": "Maximum call stack",
  "description": "Example to reproduce the error.",
  "$ref": "#/definitions/Person",
  "type": "object",
  "definitions": {
    "Person": {
      "properties": {
        "firstName": {
          "type": "string",
          "title": "First name"
        },
        "lastName": {
          "type": "string",
          "title": "Last name"
        },
        "address": {
          "title": "Hello",
          "type": "object",
          "$ref": "#/definitions/Address"
        }
      }
    },
    "Address": {
      "properties": {
        "street": {
          "type": "string",
          "title": "address2"
        },
        "resident": {
          "type": "object",
          "$ref": "#/definitions/Person"
        }
      }
    }
  }
}

@yuvi116
Copy link

yuvi116 commented Sep 13, 2019

did any one got the solution for recursive schema

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

No branches or pull requests

3 participants