lib/openapi3_parser/node/schema.rb in openapi3_parser-0.9.0 vs lib/openapi3_parser/node/schema.rb in openapi3_parser-0.9.1
- old
+ new
@@ -118,12 +118,14 @@
#
# @param [String, Schema] property
# @return [Boolean]
def requires?(property)
if property.is_a?(Schema)
+ # compare node_context of objects to ensure references aren't treated
+ # as equal - only direct properties of this object will pass.
properties.to_h
.select { |k, _| required.to_a.include?(k) }
- .any? { |_, schema| schema == property }
+ .any? { |_, schema| schema.node_context == property.node_context }
else
required.to_a.include?(property)
end
end