code: function models(spec) {
    var ids = {};
  
    if (!spec) return ids;
  
    var add = function(obj) {
      var type = model(obj);
      if (type) ids[type] = true;
    };
  
    add(spec);
  
    if (spec.properties) {
      lodash.forOwn(spec.properties, function(p) { add(p); });
    } else if (spec.parameters) {
      spec.parameters.forEach(function(p) { add(p); });
    }
  
    return Object.keys(ids);
  }
docs: Find models.