resolveOpenAPI31Strategy = async (options) => {
  const {
    spec,
    timeout,
    redirects,
    requestInterceptor,
    responseInterceptor,
    pathDiscriminator = [],
    allowMetaPatches = false,
    useCircularStructures = false,
    skipNormalization = false,
    parameterMacro = null,
    modelPropertyMacro = null,
    mode = 'non-strict',
    strategies,
  } = options;
  try {
    const { cache } = resolveOpenAPI31Strategy;
    const strategy = strategies.find((strg) => strg.match(spec));

    // determining BaseURI
    const cwd = url.isHttpUrl(url.cwd()) ? url.cwd() : DEFAULT_BASE_URL;
    const retrievalURI = optionsUtil.retrievalURI(options);
    const baseURI = url.resolve(cwd, retrievalURI);

    // prepare spec for dereferencing
    let openApiElement;
    if (cache.has(spec)) {
      openApiElement = cache.get(spec);
    } else {
      openApiElement = OpenApi3_1Element.refract(spec);
      openApiElement.classes.push('result');
      cache.set(spec, openApiElement);
    }

    const openApiParseResultElement = new ParseResultElement([openApiElement]);

    // prepare fragment for dereferencing
    const jsonPointer = jsonPointerCompile(pathDiscriminator);
    const jsonPointerURI = jsonPointer === '' ? '' : `#${jsonPointer}`;
    const fragmentElement = jsonPointerEvaluate(openApiElement, jsonPointer);

    // prepare reference set for dereferencing
    const openApiElementReference = new Reference({
      uri: baseURI,
      value: openApiParseResultElement,
    });
    const refSet = new ReferenceSet({ refs: [openApiElementReference] });
    if (jsonPointer !== '') refSet.rootRef = undefined; // reset root reference as we want fragment to become the root reference

    // prepare ancestors; needed for cases where fragment is not OpenAPI element
    const ancestors = [new Set([fragmentElement])];

    const errors = [];
    const dereferenced = await dereferenceApiDOM(fragmentElement, {
      resolve: {
        /**
         * swagger-client only supports resolving HTTP(S) URLs or spec objects.
         * If runtime env is detected as non-browser one,
         * and baseURI was not provided as part of resolver options,
         * then below baseURI check will make sure that constant HTTPS URL is used as baseURI.
         */
        baseURI: `${baseURI}${jsonPointerURI}`,
        resolvers: [
          new HTTPResolverSwaggerClient({
            timeout: timeout || 10000,
            redirects: redirects || 10,
          }),
        ],
        resolverOpts: {
          swaggerHTTPClientConfig: {
            requestInterceptor,
            responseInterceptor,
          },
        },
        strategies: [new OpenAPI3_1ResolveStrategy()],
      },
      parse: {
        mediaType: mediaTypes.latest(),
        parsers: [
          new OpenAPIJSON3_1Parser({ allowEmpty: false, sourceMap: false }),
          new OpenAPIYAML3_1Parser({ allowEmpty: false, sourceMap: false }),
          new JSONParser({ allowEmpty: false, sourceMap: false }),
          new YAMLParser({ allowEmpty: false, sourceMap: false }),
          new BinaryParser({ allowEmpty: false, sourceMap: false }),
        ],
      },
      dereference: {
        maxDepth: 100,
        strategies: [
          new OpenAPI3_1SwaggerClientDereferenceStrategy({
            allowMetaPatches,
            useCircularStructures,
            parameterMacro,
            modelPropertyMacro,
            mode,
            ancestors,
          }),
        ],
        refSet,
        dereferenceOpts: { errors },
        immutable: false,
        circular: useCircularStructures ? 'ignore' : 'replace',
        circularReplacer: useCircularStructures
          ? referenceOptions.dereference.circularReplacer
          : circularReplacer,
      },
    });
    const transcluded = transclude(fragmentElement, dereferenced, openApiElement);
    const normalized = skipNormalization ? transcluded : strategy.normalize(transcluded);

    return { spec: toValue(normalized), errors };
  } catch (error) {
    if (error instanceof JSONPointerEvaluateError) {
      return { spec, errors: [] };
    }
    throw error;
  }
}
Removing semantics from the absolutified referencing element by
using generic ObjectElement to represent the reference.