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

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

Open
4 tasks done
estk opened this issue Oct 13, 2023 · 1 comment
Open
4 tasks done
Labels
bug help wanted $ref All issues related to ref

Comments

@estk
Copy link

estk commented Oct 13, 2023

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.

@estk estk added bug needs triage Initial label given, to be assigned correct labels and assigned labels Oct 13, 2023
@estk estk changed the title <title> Recursive json-schema definition causes the browser to hang and eventually stack overflow Oct 13, 2023
@nickgros
Copy link
Contributor

@estk Thanks for creating a separate issue. At this time, we think this is an uncommon edge case. There are likely workarounds by referencing defined objects. That said, I do agree that we should prevent the infinite recursion/stack overflow issue and probably test against the JSONSchema meta-schemas. For now, since we don't have a real use case, we're going to mark this as help-wanted and re-evaluate if something else comes up.

@nickgros nickgros added help wanted $ref All issues related to ref and removed needs triage Initial label given, to be assigned correct labels and assigned labels Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help wanted $ref All issues related to ref
Projects
None yet
Development

No branches or pull requests

2 participants