Added in high document API

filling out documentation, looking at DX and how to consume things, re-shuffling and cleaning house.
This commit is contained in:
Dave Shanley
2022-09-13 08:39:38 -04:00
parent d2b974829d
commit 647541cc77
11 changed files with 682 additions and 503 deletions

View File

@@ -563,3 +563,18 @@ func DetectCase(input string) Case {
}
return RegularCase
}
// CheckEnumForDuplicates will check an array of nodes to check if there are any duplicate values.
func CheckEnumForDuplicates(seq []*yaml.Node) []*yaml.Node {
var res []*yaml.Node
seen := make(map[string]*yaml.Node)
for _, enum := range seq {
if seen[enum.Value] != nil {
res = append(res, enum)
continue
}
seen[enum.Value] = enum
}
return res
}