private void resolveTypeRefs(List<? extends ModelElement> moduleElements,
      Map<String, Type> types) {

    for (ModelElement moduleElement : moduleElements) {

      if (moduleElement instanceof TypeRef) {
        resolveTypeRef((TypeRef) moduleElement, types);
      } else {
        // A moduleElement can be null if in original Json there is a
        // comma in the last element of an array
        if (moduleElement != null) {
          resolveTypeRefs(moduleElement.getChildren(), types);
        }
      }
    }
  }