class Lutaml::Model::KeyValueMapping

def validate!(key, to, with)

def validate!(key, to, with)
  if to.nil? && with.empty?
    msg = ":to or :with argument is required for mapping '#{key}'"
    raise IncorrectMappingArgumentsError.new(msg)
  end
  if !with.empty? && (with[:from].nil? || with[:to].nil?)
    msg = ":with argument for mapping '#{key}' requires :to and :from keys"
    raise IncorrectMappingArgumentsError.new(msg)
  end
end