code: public JsonNode getRefSchemaNode(String ref) {
          JsonSchema schema = findAncestor();
          JsonNode node = schema.getSchemaNode();
  
          if (ref.startsWith("#/")) {
              // handle local ref
              String[] keys = ref.substring(2).split("/");
              for (String key : keys) {
                  try {
                      key = URLDecoder.decode(key, "utf-8");
                  } catch (UnsupportedEncodingException e) {
                  }
                  Matcher matcher = intPattern.matcher(key);
                  if (matcher.matches()) {
                      node = node.get(Integer.parseInt(key));
                  } else {
                      node = node.get(key);
                  }
                  if (node == null){
                      JsonSchema subSchema = schema.fetchSubSchemaNode(validationContext);
                      if (subSchema != null) {
                          node = subSchema.getRefSchemaNode(ref);
                      }
                  }
                  if (node == null){
                      break;
                  }
              }
          }
          return node;
      }
docs: Find the schema node for $ref attribute.
  
  @param ref String
  @return JsonNode