quobix
2024-04-21 08:55:43 -04:00
parent ac4b6ecd31
commit 1e22e0233b
2 changed files with 23 additions and 1 deletions

View File

@@ -1701,3 +1701,18 @@ components:
schemas := index.GetAllSchemas()
assert.Equal(t, 6, len(schemas))
}
func TestSpecIndex_CheckIgnoreDescriptionsInExamples(t *testing.T) {
yml := `openapi: 3.1.0
components:
examples:
example1:
description: this should be ignored`
var rootNode yaml.Node
_ = yaml.Unmarshal([]byte(yml), &rootNode)
index := NewSpecIndexWithConfig(&rootNode, CreateOpenAPIIndexConfig())
schemas := index.GetAllDescriptions()
assert.Equal(t, 0, len(schemas))
}