   random 'number', randomOptions
 
 
-generate.boolean = (schema, method = 'all', depth = 0) ->
-  random 'boolean'
+# type = string
+generate.string = (schema, method = 'all', depth = 0) ->
+  return randexp schema.pattern  if schema.pattern
+  # FIXME format should not be ignored
+  randomOptions =
+    minLength: schema.minLength
+    maxLength: schema.maxLength
+  random 'string', randomOptions
 
 
+# type = array
 generate.array = (schema, method = 'all', depth = 0) ->
   o = []
   if type(schema.items) is 'array' and schema.items.length
     for itemSchema in schema.items
       o.push generate itemSchema, method, depth + 1
-  else if type(schema.items) is 'object'
-    # FIXME items should not be a schema, really
-    console.log schema.items
-    throw "items should not be a schema, really"
 
   if schema.additionalItems
-    # break  if schema.additionalItems.$ref?[0] is '#'
     if type(schema.minItems) isnt 'undefined'
       minimum = schema.minItems - o.length
     else

  generate enumValue, method, depth + 1


generate.string = (schema, method = 'all', depth = 0) ->
  return randexp schema.pattern  if schema.pattern
  # FIXME format should not be ignored
  randomOptions =
    minLength: schema.minLength
    maxLength: schema.maxLength
  random 'string', randomOptions


generate.number = generate.integer = (schema, method = 'all', depth = 0) ->
  minimum = schema.exclusiveMinimum + 1  if schema.exclusiveMinimum
  minimum ?= schema.minimum

    when 'string', 'number', 'integer', 'boolean', 'array', 'object', 'null'
      return generate[schema.type] schema, method, depth
    else
      if type(schema.type) is 'array'
        return generate.oneOf schema, method, depth
      # FIXME what if type(schema.type) = 'object' and _.size(schema.type) > 0 ?
      if schema.type is 'any' or type(schema.type) is 'undefined' or (type(schema.type) is 'object' and _.size(schema.type) is 0)
        return generate.any schema, method, depth
      # FIXME what type is this?
      console.log schema.type
      throw "what type is this ?"


# enum
generate.enum = (schema, method = 'all', depth = 0) ->
  randomOptions =
    minimum: 0
