Module: Avromatic::Model::FieldHelper
Instance Method Summary collapse
-
#optional?(field) ⇒ Boolean
An optional field is represented as a union where the first member is null.
- #required?(field) ⇒ Boolean
Instance Method Details
#optional?(field) ⇒ Boolean
An optional field is represented as a union where the first member is null.
10 11 12 13 |
# File 'lib/avromatic/model/field_helper.rb', line 10 def optional?(field) field.type.type_sym == :union && field.type.schemas.first.type_sym == :null end |
#required?(field) ⇒ Boolean
15 16 17 |
# File 'lib/avromatic/model/field_helper.rb', line 15 def required?(field) !optional?(field) end |