lib/avromatic/model/attribute/union.rb in avromatic-0.31.0 vs lib/avromatic/model/attribute/union.rb in avromatic-0.32.0.rc0

- old
+ new

@@ -45,10 +45,15 @@ private def safe_coerce(member_attribute, input) coerced = member_attribute.coerce(input) - coerced unless coerced.is_a?(Avromatic::Model::Attributes) && coerced.invalid? + + if coerced.is_a?(Avromatic::Model::Attributes) + coerced if coerced.valid? + elsif member_attribute.coerced?(coerced) + coerced + end rescue nil end def member_attributes