fix: Check for direct reference in IsPropertyNodeRequired

This commit is contained in:
Benjamin Nolan (TwoWholeWorms)
2023-01-07 08:53:53 +01:00
committed by Dave Shanley
parent d526584d4f
commit cd63f66efe
2 changed files with 7 additions and 1 deletions

View File

@@ -405,6 +405,12 @@ func IsNodeRefValue(node *yaml.Node) (bool, *yaml.Node, string) {
// IsPropertyNodeRequired will check if a node is required within circular references
func IsPropertyNodeRequired(node *yaml.Node, propertyName string) bool {
// If the node we're looking at is a direct ref to another model without any properties, mark it as required
isRef, _, _ := IsNodeRefValue(node)
if isRef {
return true
}
_, requiredSeqNode := FindKeyNodeTop("required", node.Content)
if requiredSeqNode == nil {
return false