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

Composition with circular reference causes infinite loop #459

Closed
philschleier opened this issue Feb 19, 2024 · 4 comments
Closed

Composition with circular reference causes infinite loop #459

philschleier opened this issue Feb 19, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@philschleier
Copy link

The following spec causes vacuum to spin infinitely and consume all available memory:

openapi: "3.0.1"

info:
  title: Test
  version: 1.0.0

paths: {}

components:
  schemas:
    A:
      type: object
      properties: {}

    B:
      type: object
      allOf:
        - $ref: '#/components/schemas/A'
      properties:
        children:
          type: array
          items:
            $ref: '#/components/schemas/B'

Not sure what to call it, not even sure if it's valid, but probably shouldn't break vacuum...

@philschleier philschleier changed the title Composition with ciruclar reference causes infinite loop Composition with circular reference causes infinite loop Feb 19, 2024
@daveshanley
Copy link
Owner

which version of vacuum did you test against?

@philschleier
Copy link
Author

v0.9.7

image

@daveshanley
Copy link
Owner

ok, this is nuts. I will fix.

@daveshanley daveshanley added the bug Something isn't working label Feb 19, 2024
daveshanley added a commit to pb33f/libopenapi that referenced this issue Feb 20, 2024
there is more data being picked up now by the resolver for circular references, various entities were being missed
but now there with a few tweaks, it’s picking up more circles.

Signed-off-by: quobix <dave@quobix.com>
daveshanley added a commit to pb33f/libopenapi that referenced this issue Feb 20, 2024
Signed-off-by: quobix <dave@quobix.com>
daveshanley added a commit to pb33f/libopenapi that referenced this issue Feb 20, 2024
Signed-off-by: quobix <dave@quobix.com>
@daveshanley daveshanley mentioned this issue Feb 20, 2024
@daveshanley
Copy link
Owner

This problem was in libopenapi. In v0.15.12 it was fixed, the resolver was not continuing down a path correctly once finding a sibling node that uses a reference.

I added a test to make sure this loop is closed permanently.

https://github.com/pb33f/libopenapi/blob/main/index/resolver_test.go#L1339

The upstream fix is available in v0.9.8 of vacuum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants