mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 04:20:11 +00:00
Properties named ‘enum’ were being indexed as enums
An edge case reported in https://github.com/daveshanley/vacuum/issues/339 shows up when enums are being indexed when they are actually a property of a schema called ‘enum’. This has been fixed. Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
@@ -329,6 +329,11 @@ func (index *SpecIndex) ExtractRefs(node, parent *yaml.Node, seenPath []string,
|
||||
// capture enums
|
||||
if n.Value == "enum" {
|
||||
|
||||
lastItem := seenPath[len(seenPath)-1]
|
||||
if lastItem == "properties" {
|
||||
continue
|
||||
}
|
||||
|
||||
// all enums need to have a type, extract the type from the node where the enum was found.
|
||||
_, enumKeyValueNode := utils.FindKeyNodeTop("type", node.Content)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user