Skip to content

Commit

Permalink
replicate circular refs issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Reuven committed Jul 1, 2024
1 parent 42a2d80 commit 0208418
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
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'
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

0 comments on commit 0208418

Please sign in to comment.