Skip to content

StackOverflowError with object having an array of itself #332

@mcruzdev

Description

@mcruzdev

Actually when using this OAPI specification (on quarkus-openapi-generator-server side):

{
  "openapi": "3.0.3",
  "info": {
    "title": "Recursive Example API",
    "version": "1.0.0"
  },
  "paths": {
    "/example": {
      "get": {
        "summary": "Get Something",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Something"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Something": {
        "type": "object",
        "properties": {
          "someGroup": {
            "type": "array",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/Something"
                }
              ]
            }
          }
        }
      }
    }
  }
}

We are getting a StackOverflowException.

You can reproduce this one, using my branch https://github.com/mcruzdev/apicurio-codegen/tree/issue-stackoverflow and executing the test testConstraintParameters_allOfSelfRef from an IDE.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions