code: function model(obj) {
    if (!obj) return;
  
    if (obj.$ref) {
      obj = obj.$ref;
    } else if (obj.type === 'array' && obj.items && obj.items.$ref) {
      obj = obj.items.$ref;
    } else if (obj.type) {
      obj = obj.type;
    }
  
    // ensure valid type
    if (typeof obj !== 'string') return;
    // ensure non-builtin type
    if (constants.notModel.indexOf(obj) >= 0) return;
  
    return obj;
  }
docs: Find model.