# File lib/cgikit/declaration.rb, line 69
  def validate_api( component_class = nil )
    msg = "Found validation errors in \"#{component_class}\"."
    error = ValidationError.new(msg)
    keys = @declarations.keys
    keys.map! {|key| key.to_s}
    keys.sort.each do |key|
      dec = @declarations[key.intern]
      if api = dec.element_type.api then
        errors = api.validate(dec.association_hash, component_class, key)
        if errors then
          error << errors
        end
      end
    end

    unless error.errors.empty? then
      raise error
    end
  end