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

InternalizeRefs can result in a stack overflow with recursive references #623

Closed
jamietanna opened this issue Oct 5, 2022 · 1 comment
Closed

Comments

@jamietanna
Copy link
Contributor

When trying to InternalizeRefs on a recursive reference, we get a Stack Overflow error.

Spec (via)

openapi: 3.0.2
info:
  version: '0.0.1'
  title: example
  description: |
    Make sure that recursive types are handled properly
paths:
  /example:
    get:
      operationId: exampleGet
      responses:
        '200':
          description: "OK"
          content:
            'application/json':
              schema:
                $ref: '#/components/schemas/Document'
components:
  schemas:
    Document:
      type: object
      properties:
        fields:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Value'
    Value:
      type: object
      properties:
        stringValue:
          type: string
        arrayValue:
          $ref: '#/components/schemas/ArrayValue'
    ArrayValue:
      type: array
      items:
        $ref: '#/components/schemas/Value'

Not sure if this is allowed behaviour in OpenAPI, but it's something we test against in our project, and may be worth us protecting against here, too?

@jamietanna
Copy link
Contributor Author

Looks like this has been resolved in a later release, quite possibly due to changes in #628 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant