code: def validate_arguments(args_hash, fields_list, type_ns = nil)
        check_extra_fields(args_hash, array_from_named_list(fields_list))
        add_order_key(args_hash, fields_list)
        fields_list.each do |field|
          key = field[:name]
          item = args_hash[key]
          check_required_argument_present(item, field)
          unless item.nil?
            original_name = field[:original_name]
            if original_name
              key = handle_name_override(args_hash, key, original_name)
            end
  
            item_type = get_full_type_signature(field[:type])
            item_ns = field[:ns] || type_ns
            key = handle_namespace_override(args_hash, key, item_ns) if item_ns
  
            # Separate validation for choice types as we need to inject nodes into
            # the tree. Validate as usual if not a choice type.
            unless validate_choice_argument(item, args_hash, key, item_type)
              validate_arg(item, args_hash, key, item_type)
            end
          end
        end
        return args_hash
      end
docs: Validates given arguments based on provided fields list.