code: function(def) {
      def = def ? def : _.result(this, 'definition');
  
      return _.reduce(def, function(schema, attr, key) {
        if (attr.type === 'object') {
          schema[key] = this.schema(attr.fields || {});
        } else if (attr.type === 'array') {
          if (attr.value_type === 'object') {
            schema[key] = [this.schema(attr.fields || {})];
          } else if (attr.value_type) {
            schema[key] = [attr.value_type];
          } else {
            schema[key] = [];
          }
        } else {
          schema[key] = attr.type;
        }
        return schema;
      }.bind(this), {});
    }
docs: Get the types of each attribute.
  
  Define schema as a function.
  
  See `model.spec.js` for how to use
  
  @param  {Object} def
  @return {Object}