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

replicate circular refs issue #973

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions openapi3/loader_circular_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package openapi3

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestLoadCircular(t *testing.T) {
loader := NewLoader()
loader.IsExternalRefsAllowed = true
_, err := loader.LoadFromFile("testdata/circularRef2/circular2.yaml")
require.NoError(t, err)
}
7 changes: 7 additions & 0 deletions openapi3/testdata/circularRef2/AwsEnvironmentSettings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: object
properties:
children:
type: array
items:
$ref: './AWSEnvironmentSettings.yaml'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: replacing this with '#/' passes tests

description: test
16 changes: 16 additions & 0 deletions openapi3/testdata/circularRef2/circular2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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
Loading