lib/dry/swagger/struct_parser.rb in dry-swagger-0.5.1 vs lib/dry/swagger/struct_parser.rb in dry-swagger-0.5.2
- old
+ new
@@ -117,13 +117,12 @@
def visit_sum(node, opts = {})
if node[0][0].equal?(:constrained)
opts[:nullable] = true
visit(node[1], opts) # ignore NilClass constrained
- elsif node[0][0].equal?(:struct) && node[1][0].equal?(:struct)
+ elsif node[0][0].equal?(:struct) || node[0][0].equal?(:sum)
opts[:oneOf] = true
- visit(node[0], opts)
- visit(node[1], opts)
+ node.each { |child| visit(child, opts) unless child.is_a?(Hash) }
end
end
def visit_struct(node, opts = {})
opts[:member] = true
\ No newline at end of file