mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-09 12:37:49 +00:00
fix: Check for direct reference in IsPropertyNodeRequired
This commit is contained in:
committed by
Dave Shanley
parent
d526584d4f
commit
cd63f66efe
@@ -1721,7 +1721,7 @@ func (index *SpecIndex) extractDefinitionRequiredRefProperties(schemaNode *yaml.
|
|||||||
return reqRefProps
|
return reqRefProps
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the path we're looking at is a direct ref to another model without any properties, mark it as required, but still continue to look for required properties
|
// If the node we're looking at is a direct ref to another model without any properties, mark it as required, but still continue to look for required properties
|
||||||
isRef, _, defPath := utils.IsNodeRefValue(schemaNode)
|
isRef, _, defPath := utils.IsNodeRefValue(schemaNode)
|
||||||
if isRef {
|
if isRef {
|
||||||
if _, ok := reqRefProps[defPath]; !ok {
|
if _, ok := reqRefProps[defPath]; !ok {
|
||||||
|
|||||||
@@ -405,6 +405,12 @@ func IsNodeRefValue(node *yaml.Node) (bool, *yaml.Node, string) {
|
|||||||
|
|
||||||
// IsPropertyNodeRequired will check if a node is required within circular references
|
// IsPropertyNodeRequired will check if a node is required within circular references
|
||||||
func IsPropertyNodeRequired(node *yaml.Node, propertyName string) bool {
|
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)
|
_, requiredSeqNode := FindKeyNodeTop("required", node.Content)
|
||||||
if requiredSeqNode == nil {
|
if requiredSeqNode == nil {
|
||||||
return false
|
return false
|
||||||
|
|||||||
Reference in New Issue
Block a user