validateOAS3RefsForHeadersReferenceHeadersPositions = () => sys => {
  return sys.validateSelectors
    .allHeaders()
    .then(nodes => {
      return nodes.reduce((acc, node) => {
        const value = node.node
        const ref = value.$ref

        if(!ref) {
          return acc
        }

        /**
         * We only do the check for local JSON Pointers. In order to check remote JSON Pointer
         * we would have to resolve it and assert for the shape of the referenced structure.
         */
        if (ref.startsWith("#/")) {
          const foundHeader = nodes.find((node) => {
            const headerPointer = `#/${node.path.map(escapeJsonPointerToken).join("/")}`
            return headerPointer === ref
          })

          if (typeof foundHeader === "undefined") {
            acc.push({
              level: "error",
              message: `OAS3 header $refs should point to Header Object and not ${ref}`,
              path: [...node.path, "$ref"]
            })
          }
        }

        return acc
      }, [])
    })
}
We only do the check for local JSON Pointers. In order to check remote JSON Pointer
we would have to resolve it and assert for the shape of the referenced structure.