lib/dry/swagger/struct_parser.rb in dry-swagger-0.4.1 vs lib/dry/swagger/struct_parser.rb in dry-swagger-0.4.2
- old
+ new
@@ -108,11 +108,15 @@
def visit_enum(node, opts = {})
visit(node[0], opts)
end
def visit_sum(node, opts = {})
- opts[:nullable] = true
- visit(node[1], opts)
+ if node[0][0].equal?(:constrained)
+ opts[:nullable] = true
+ visit(node[1], opts) # ignore NilClass constrained
+ elsif node[0][0].equal?(:struct)
+ visit(node[0], opts) # grab left operand, this means if you have it defined as DTO1 | DTO2, it will grab DTO1
+ end
end
def visit_struct(node, opts = {})
opts[:member] = true
\ No newline at end of file