code: function resolveRef(schemaObj, resolvedValues) {
              // the array store referenced value
              var refVal = schemaObj.refVal;
              // the map store full ref id and index of the referenced value in refVal
              // example: { 'test#definitions/option' : 1, 'test#definitions/repo' : 2 }
              var refs = schemaObj.refs;
              // the map to store schema value with sub reference
              var subRefs = {};
  
              _.forEach(refs, function (index, refId) {
                  // if reference id already resolved then continue the loop
                  if (refId in resolvedValues) {
                      return true; // continue
                  }
  
                  var refValue = refVal[index];
                  // if no further nested reference, add to resolved map
                  if (_.isEmpty(refValue.refs)) {
                      resolvedValues[refId] = refValue;
                      return true;
                  }
  
                  // add schema value with sub reference to map to resolve later
                  subRefs[refId] = refValue;
              });
  
              // resolve sub reference recursively
              _.forEach(subRefs, function (subRef, refId) {
                  resolvedValues[refId] = 1;
                  resolvedValues[refId] = resolveRef(subRef, resolvedValues);
              });
  
              return schemaObj.schema;
          }
docs: resolve reference recursively it search the compiled schema data structure from ajv.getSchema, find out and store referenced value to resolvedValues map