Complex blocks with nested loops and if statements like this will *always* warrant a few comments to help the reader walk through what is happening. For example, in the if statements, just say in plain english the logical meaning of the boolean statement:

`if (! _.contains(Constants.primitives, type) && ! _.contains(requiredModelNames, type)) {`

Could have a block saying:

`// If the current property type is not a primitive, and isn't a model object we have seen yet, then we add it to the current set of models that are required for this endpoint`