diff --git a/openapi3/loader_circular_test.go b/openapi3/loader_circular_test.go new file mode 100644 index 00000000..186dfbd5 --- /dev/null +++ b/openapi3/loader_circular_test.go @@ -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) +} diff --git a/openapi3/testdata/circularRef2/AwsEnvironmentSettings.yaml b/openapi3/testdata/circularRef2/AwsEnvironmentSettings.yaml new file mode 100644 index 00000000..21887b0c --- /dev/null +++ b/openapi3/testdata/circularRef2/AwsEnvironmentSettings.yaml @@ -0,0 +1,7 @@ +type: object +properties: + children: + type: array + items: + $ref: './AWSEnvironmentSettings.yaml' +description: test diff --git a/openapi3/testdata/circularRef2/circular2.yaml b/openapi3/testdata/circularRef2/circular2.yaml new file mode 100644 index 00000000..48f95ae2 --- /dev/null +++ b/openapi3/testdata/circularRef2/circular2.yaml @@ -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