Skip to content

Recursive models are not supported #35

Open
@Deadarius

Description

@Deadarius

Atttempts to use JSON schemas with definitions that are referencing themselves leads to stack overflow and crash.

Steps to reproduce:

  1. create a schema:
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "definitions": {
    "folder": {
      "type": "object",
      "title": "Folder Schema",
      "properties": {
        "id": {
          "type": "string",
          "example": "3ba1c69c-3c81-4d6d-b304-873d898b2e3c",
          "format": "uuid"
        },
        "name": {
          "type": "string",
          "example": "Level 1"
        },
        "folders": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/folder"
          }
        }
      },
      "additionalProperties": false,
      "required": ["id", "folders"]
    }
  },
  "type": "object",
  "title": "Folders Response Schema",
  "properties": {
    "data": {
      "$ref": "#/definitions/folder"
    }
  }
}
  1. reference schema in serverless documentation
  2. run serverless openapi generate

Outcome: Error(maximum call stack size exceeded)
Expected: openapi document is generated

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