module Lutaml::Model::Serialize::ClassMethods

def attr_value_valid?(name, value)

Check if the value to be assigned is valid for the attribute
def attr_value_valid?(name, value)
  attr = attributes[name]
  return true unless attr.options[:values]
  # Allow nil values if there's no default
  return true if value.nil? && !attr.default
  # Use the default value if the value is nil
  value = attr.default if value.nil?
  attr.options[:values].include?(value)
end