Skip to content

stack overflow when using a recursive schema #40

@aatifsyed

Description

@aatifsyed
$ git show
commit f49845a5ec744073f7e7cc7e76117fb436147b4a (HEAD -> main, origin/main, origin/HEAD)
Merge: 1ac937e afb6949
Author: getsentry-bot <bot@getsentry.com>
Date:   Tue Jun 6 10:15:49 2023 +0000

    Merge branch 'release/0.1.7'

$ cat schema.json 
{
    "$ref": "#/definitions/recursive_array",
    "definitions": {
        "recursive_array": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/recursive_array"
            }
        }
    }
}
$ cargo run --quiet --features build-binary -- schema.json schema.json 

thread 'main' has overflowed its stack
fatal runtime error: stack overflow
Aborted

This precludes checking e.g ASTs which look like this:

{
  "$ref": "#/definitions/node",
  "definitions" {
    "node": {
      "type": "object",
      "properties": {
        "name:": { "type": "string" },
        "children": { "type": "array", "items": "#/definitions/node" },
      }
      "required": ["name", "children"]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions