Skip to content

Circular references in separate files results in stack overflow error #442

@jacobdekeizer

Description

@jacobdekeizer

Describe the bug
We have an open api specification with circular references where each object is stored in a separate file. This results in a stack overflow error:

runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0x140ade80340 stack=[0x140ade80000, 0x140cde80000]
fatal error: stack overflow

runtime stack:
runtime.throw({0x1048394c0?, 0x104347498?})

I am on the latest version and the pr #418 did not fix the issue for our scenario.

To Reproduce

I've made two example files based on the example files in pr #418:

circular2.yaml

openapi: 3.0.0
info:
    title: Circular Reference Example
    version: 1.0.0
paths:
    /sample:
        put:
            requestBody:
                required: true
                content:
                    application/json:
                        schema:
                            $ref: './AwsEnvironmentSettings.yaml'
            responses:
                '200':
                    description: Ok

AwsEnvironmentSettings.yaml

type: object
properties:
    children:
        type: array
        items:
            $ref: './AWSEnvironmentSettings.yaml'
description: test

Steps to reproduce the behavior:

  1. Create the 2 files above
  2. oasdiff breaking ./circular2.yaml ./circular2.yaml

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