module Avromatic::Model::FieldHelper
Public Instance Methods
boolean?(field)
click to toggle source
# File lib/avromatic/model/field_helper.rb, line 23 def boolean?(field) field.type.type_sym == :boolean || (optional?(field) && field.type.schemas.last.type_sym == :boolean) end
nullable?(field)
click to toggle source
# File lib/avromatic/model/field_helper.rb, line 19 def nullable?(field) optional?(field) || field.type.type_sym == :null end
optional?(field)
click to toggle source
An optional field is represented as a union where the first member is null.
# 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)
click to toggle source
# File lib/avromatic/model/field_helper.rb, line 15 def required?(field) !optional?(field) end