From 7e87545f8a1c87db2bf704412258c59df64c145e Mon Sep 17 00:00:00 2001 From: quobix Date: Sun, 21 Apr 2024 09:03:53 -0400 Subject: [PATCH] Added test for #481 --- index/spec_index_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/index/spec_index_test.go b/index/spec_index_test.go index cb979189..9de7525a 100644 --- a/index/spec_index_test.go +++ b/index/spec_index_test.go @@ -1716,3 +1716,27 @@ components: schemas := index.GetAllDescriptions() assert.Equal(t, 0, len(schemas)) } + +func TestSpecIndex_Issue481(t *testing.T) { + yml := `openapi: 3.0.1 +components: + schemas: + PetPot: + type: object + properties: + value: + oneOf: + - type: array + items: + type: object + required: + - $ref + - value` + + var rootNode yaml.Node + _ = yaml.Unmarshal([]byte(yml), &rootNode) + + index := NewSpecIndexWithConfig(&rootNode, CreateOpenAPIIndexConfig()) + schemas := index.GetAllReferences() + assert.Equal(t, 0, len(schemas)) +}