Added test for #481

This commit is contained in:
quobix
2024-04-21 09:03:53 -04:00
parent 1e22e0233b
commit 7e87545f8a

View File

@@ -1716,3 +1716,27 @@ components:
schemas := index.GetAllDescriptions() schemas := index.GetAllDescriptions()
assert.Equal(t, 0, len(schemas)) 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))
}