def key (name, *args)
      options = args.extract_options!
      name = name.to_s
      json_type = args.first || String
      
      raise ArgumentError.new("too many arguments (must be 1 or 2 plus an options hash)") if args.length > 1
        
      field = FieldDefinition.new(name, :type => json_type, :default => options[:default])
      fields[name] = field
      add_json_validations(field, options)
      define_json_accessor(field, json_field_name)
    end
def key (name, *args)
      options = args.extract_options!
      name = name.to_s
      json_type = args.first || String
      
      raise ArgumentError.new("too many arguments (must be 1 or 2 plus an options hash)") if args.length > 1
        
      field = FieldDefinition.new(name, :type => json_type, :default => options[:default])
      fields[name] = field
      add_json_validations(field, options)
      define_json_accessor(field, json_field_name)
    end
Create a schema on the class for a particular field.
 Define a single valued field in the schema.
 The first argument is the field name. This must be unique for the class accross all attributes.

 The optional second argument can be used to specify the class of the field values. It will default to
 String if not specified. Valid types are String, Integer, Float, Date, Time, DateTime, Boolean, Array, Hash,
 or any class that inherits from EmbeddedDocument.

 The last argument can be a hash with any of these keys:
 * :default -
 * :required -
 * :length -
 * :format -
 * :in -