rjsf-team/react-jsonschema-form

Recursive json-schema definition causes the browser to hang and eventually stack overflow

Chiusa

#3907 aperta il 13 ott 2023

 (7 commenti) (0 reazioni) (1 assegnatario)TypeScript (2136 fork)batch import
$refbughelp wanted

Metriche repository

Star
 (13.175 stelle)
Metriche merge PR
 (Merge medio 3g 17h) (32 PR mergiate in 30 g)

Descrizione

Prerequisites

What theme are you using?

core

Version

5.x

Current Behavior

Schema:

{
  "title": "A registration form",
  "description": "A simple form example.",
  "type": "object",
  "properties": {
    "child": {
      "$ref": "#"
    }
  }
}

Expected Behavior

Not to hang aka eventually stack overflow

Steps To Reproduce

Paste that schema into the playground, that schema is a simplification of what happens when I attempt to use the draft-07 json-schema meta-schema.

Environment

N/A

Anything else?

@heath-freenome , as requested in #3560. I dont really know anything about react anymore, but just poking around for a bit, the Form seems to be trying to render a recursive reference. It seems like the correct behavior should either be an error something like: "Hey, we don't allow recursive references", or just build the feature which marks definitions as seen, which may require a bit of a change in strat from DFS to BFS of the schema tree.

Also, im not sure if its a goal of this project, but it seems to me some good test cases are actually the json-schema meta-schemas. But I recon that is a separate issue altogether.

Guida contributor