{"name":"@swagger-api/apidom-reference","version":"1.1.0","author":{"name":"Vladimir Gorej"},"license":"Apache-2.0","_id":"@swagger-api/apidom-reference@1.1.0","maintainers":[{"name":"swagger-api","email":"apiteam@swagger.io"}],"homepage":"https://github.com/swagger-api/apidom#readme","bugs":{"url":"https://github.com/swagger-api/apidom/issues"},"dist":{"shasum":"d2efa92a8e9b25a26c9bb26ed52494990fb4e43f","tarball":"http://registry-npm.ywwl.com/@swagger-api/apidom-reference/download/@swagger-api/apidom-reference-1.1.0.tgz","fileCount":287,"integrity":"sha512-jypjCMRPDYhWXTl8+RMpIGWkj44BrokUYWZR4BneeeI/KN25amnEWH7H/cE3lu0dU65EKMgff42Lt5x5DBHbvA==","signatures":[{"sig":"MEUCIAzCI/iHa2DqzJnarPLjvOgA9LzAQd4+EEBzw+eY3GUsAiEAn3MexD39Z9qVbvrUUSoRgSKyNuZzBLDnhcvPRMisOlQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1518654,"size":251541,"noattachment":false,"key":"/@swagger-api/apidom-reference/-/@swagger-api/apidom-reference-1.1.0.tgz"},"main":"./src/configuration/saturated.cjs","type":"module","types":"./types/apidom-reference.d.ts","unpkg":"./dist/apidom-reference.browser.min.js","browser":{"./src/parse/parsers/binary/index-node.cjs":"./src/parse/parsers/binary/index-browser.cjs","./src/parse/parsers/binary/index-node.mjs":"./src/parse/parsers/binary/index-browser.mjs","./src/resolve/resolvers/file/index-node.cjs":"./src/resolve/resolvers/file/index-browser.cjs","./src/resolve/resolvers/file/index-node.mjs":"./src/resolve/resolvers/file/index-browser.mjs"},"exports":{".":{"types":"./types/apidom-reference.d.ts","import":"./src/configuration/saturated.mjs","require":"./src/configuration/saturated.cjs"},"./parse/parsers/json":{"types":"./types/parse/parsers/json/index.d.ts","import":"./src/parse/parsers/json/index.mjs","require":"./src/parse/parsers/json/index.cjs"},"./configuration/empty":{"types":"./types/apidom-reference.d.ts","import":"./src/configuration/empty.mjs","require":"./src/configuration/empty.cjs"},"./parse/parsers/binary":{"browser":{"types":"./types/parse/parsers/binary/index-browser.d.ts","import":"./src/parse/parsers/binary/index-browser.mjs","require":"./src/parse/parsers/binary/index-browser.cjs"},"default":{"types":"./types/parse/parsers/binary/index-node.d.ts","import":"./src/parse/parsers/binary/index-node.mjs","require":"./src/parse/parsers/binary/index-node.cjs"}},"./parse/parsers/yaml-1-2":{"types":"./types/parse/parsers/yaml-1-2/index.d.ts","import":"./src/parse/parsers/yaml-1-2/index.mjs","require":"./src/parse/parsers/yaml-1-2/index.cjs"},"./resolve/resolvers/file":{"browser":{"types":"./types/resolve/resolvers/file/index-browser.d.ts","import":"./src/resolve/resolvers/file/index-browser.mjs","require":"./src/resolve/resolvers/file/index-browser.cjs"},"default":{"types":"./types/resolve/resolvers/file/index-node.d.ts","import":"./src/resolve/resolvers/file/index-node.mjs","require":"./src/resolve/resolvers/file/index-node.cjs"}},"./configuration/saturated":{"types":"./types/apidom-reference.d.ts","import":"./src/configuration/saturated.mjs","require":"./src/configuration/saturated.cjs"},"./parse/parsers/apidom-json":{"types":"./types/parse/parsers/apidom-json/index.d.ts","import":"./src/parse/parsers/apidom-json/index.mjs","require":"./src/parse/parsers/apidom-json/index.cjs"},"./resolve/strategies/apidom":{"types":"./types/resolve/strategies/apidom/index.d.ts","import":"./src/resolve/strategies/apidom/index.mjs","require":"./src/resolve/strategies/apidom/index.cjs"},"./parse/parsers/arazzo-json-1":{"types":"./types/parse/parsers/arazzo-json-1/index.d.ts","import":"./src/parse/parsers/arazzo-json-1/index.mjs","require":"./src/parse/parsers/arazzo-json-1/index.cjs"},"./parse/parsers/arazzo-yaml-1":{"types":"./types/parse/parsers/arazzo-yaml-1/index.d.ts","import":"./src/parse/parsers/arazzo-yaml-1/index.mjs","require":"./src/parse/parsers/arazzo-yaml-1/index.cjs"},"./parse/parsers/openapi-json-2":{"types":"./types/parse/parsers/openapi-json-2/index.d.ts","import":"./src/parse/parsers/openapi-json-2/index.mjs","require":"./src/parse/parsers/openapi-json-2/index.cjs"},"./parse/parsers/openapi-yaml-2":{"types":"./types/parse/parsers/openapi-yaml-2/index.d.ts","import":"./src/parse/parsers/openapi-yaml-2/index.mjs","require":"./src/parse/parsers/openapi-yaml-2/index.cjs"},"./resolve/resolvers/http-axios":{"types":"./types/resolve/resolvers/http-axios/index.d.ts","import":"./src/resolve/resolvers/http-axios/index.mjs","require":"./src/resolve/resolvers/http-axios/index.cjs"},"./resolve/strategies/openapi-2":{"types":"./types/resolve/strategies/openapi-2/index.d.ts","import":"./src/resolve/strategies/openapi-2/index.mjs","require":"./src/resolve/strategies/openapi-2/index.cjs"},"./bundle/strategies/openapi-3-1":{"types":"./types/bundle/strategies/openapi-3-1/index.d.ts","import":"./src/bundle/strategies/openapi-3-1/index.mjs","require":"./src/bundle/strategies/openapi-3-1/index.cjs"},"./dereference/strategies/apidom":{"types":"./types/dereference/strategies/apidom/index.d.ts","import":"./src/dereference/strategies/apidom/index.mjs","require":"./src/dereference/strategies/apidom/index.cjs"},"./parse/parsers/asyncapi-json-2":{"types":"./types/parse/parsers/asyncapi-json-2/index.d.ts","import":"./src/parse/parsers/asyncapi-json-2/index.mjs","require":"./src/parse/parsers/asyncapi-json-2/index.cjs"},"./parse/parsers/asyncapi-json-3":{"types":"./types/parse/parsers/asyncapi-json-3/index.d.ts","import":"./src/parse/parsers/asyncapi-json-3/index.mjs","require":"./src/parse/parsers/asyncapi-json-3/index.cjs"},"./parse/parsers/asyncapi-yaml-2":{"types":"./types/parse/parsers/asyncapi-yaml-2/index.d.ts","import":"./src/parse/parsers/asyncapi-yaml-2/index.mjs","require":"./src/parse/parsers/asyncapi-yaml-2/index.cjs"},"./parse/parsers/asyncapi-yaml-3":{"types":"./types/parse/parsers/asyncapi-yaml-3/index.d.ts","import":"./src/parse/parsers/asyncapi-yaml-3/index.mjs","require":"./src/parse/parsers/asyncapi-yaml-3/index.cjs"},"./resolve/strategies/asyncapi-2":{"types":"./types/resolve/strategies/asyncapi-2/index.d.ts","import":"./src/resolve/strategies/asyncapi-2/index.mjs","require":"./src/resolve/strategies/asyncapi-2/index.cjs"},"./parse/parsers/openapi-json-3-0":{"types":"./types/parse/parsers/openapi-json-3-0/index.d.ts","import":"./src/parse/parsers/openapi-json-3-0/index.mjs","require":"./src/parse/parsers/openapi-json-3-0/index.cjs"},"./parse/parsers/openapi-json-3-1":{"types":"./types/parse/parsers/openapi-json-3-1/index.d.ts","import":"./src/parse/parsers/openapi-json-3-1/index.mjs","require":"./src/parse/parsers/openapi-json-3-1/index.cjs"},"./parse/parsers/openapi-yaml-3-0":{"types":"./types/parse/parsers/openapi-yaml-3-0/index.d.ts","import":"./src/parse/parsers/openapi-yaml-3-0/index.mjs","require":"./src/parse/parsers/openapi-yaml-3-0/index.cjs"},"./parse/parsers/openapi-yaml-3-1":{"types":"./types/parse/parsers/openapi-yaml-3-1/index.d.ts","import":"./src/parse/parsers/openapi-yaml-3-1/index.mjs","require":"./src/parse/parsers/openapi-yaml-3-1/index.cjs"},"./resolve/strategies/openapi-3-0":{"types":"./types/resolve/strategies/openapi-3-0/index.d.ts","import":"./src/resolve/strategies/openapi-3-0/index.mjs","require":"./src/resolve/strategies/openapi-3-0/index.cjs"},"./resolve/strategies/openapi-3-1":{"types":"./types/resolve/strategies/openapi-3-1/index.d.ts","import":"./src/resolve/strategies/openapi-3-1/index.mjs","require":"./src/resolve/strategies/openapi-3-1/index.cjs"},"./dereference/strategies/openapi-2":{"types":"./types/dereference/strategies/openapi-2/index.d.ts","import":"./src/dereference/strategies/openapi-2/index.mjs","require":"./src/dereference/strategies/openapi-2/index.cjs"},"./dereference/strategies/asyncapi-2":{"types":"./types/dereference/strategies/asyncapi-2/index.d.ts","import":"./src/dereference/strategies/asyncapi-2/index.mjs","require":"./src/dereference/strategies/asyncapi-2/index.cjs"},"./dereference/strategies/openapi-3-0":{"types":"./types/dereference/strategies/openapi-3-0/index.d.ts","import":"./src/dereference/strategies/openapi-3-0/index.mjs","require":"./src/dereference/strategies/openapi-3-0/index.cjs"},"./dereference/strategies/openapi-3-1":{"types":"./types/dereference/strategies/openapi-3-1/index.d.ts","import":"./src/dereference/strategies/openapi-3-1/index.mjs","require":"./src/dereference/strategies/openapi-3-1/index.cjs"},"./parse/parsers/api-design-systems-json":{"types":"./types/parse/parsers/api-design-systems-json/index.d.ts","import":"./src/parse/parsers/api-design-systems-json/index.mjs","require":"./src/parse/parsers/api-design-systems-json/index.cjs"},"./parse/parsers/api-design-systems-yaml":{"types":"./types/parse/parsers/api-design-systems-yaml/index.d.ts","import":"./src/parse/parsers/api-design-systems-yaml/index.mjs","require":"./src/parse/parsers/api-design-systems-yaml/index.cjs"},"./dereference/strategies/openapi-3-1/selectors/uri":{"types":"./types/dereference/strategies/openapi-3-1/selectors/uri.d.ts","import":"./src/dereference/strategies/openapi-3-1/selectors/uri.mjs","require":"./src/dereference/strategies/openapi-3-1/selectors/uri.cjs"},"./dereference/strategies/apidom/selectors/element-id":{"types":"./types/dereference/strategies/apidom/selectors/element-id.d.ts","import":"./src/dereference/strategies/apidom/selectors/element-id.mjs","require":"./src/dereference/strategies/apidom/selectors/element-id.cjs"},"./dereference/strategies/openapi-3-1/selectors/$anchor":{"types":"./types/dereference/strategies/openapi-3-1/selectors/$anchor.d.ts","import":"./src/dereference/strategies/openapi-3-1/selectors/$anchor.mjs","require":"./src/dereference/strategies/openapi-3-1/selectors/$anchor.cjs"}},"gitHead":"b8fcc23c7b82e06a2dd3e121d551438b07028ee8","imports":{"#fs":{"node":{"import":"./src/util/polyfills/fs/protocol-import.mjs","require":"./src/util/polyfills/fs/standard-import.cjs"},"default":"./src/util/polyfills/fs/standard-import.cjs"},"#util":{"node":{"import":"./src/util/polyfills/util/protocol-import.mjs","require":"./src/util/polyfills/util/standard-import.cjs"},"default":"./src/util/polyfills/util/standard-import.cjs"},"#buffer":{"node":{"import":"./src/util/polyfills/buffer/protocol-import.mjs","require":"./src/util/polyfills/buffer/standard-import.cjs"},"default":"./src/util/polyfills/buffer/standard-import.cjs"}},"scripts":{"lint":"eslint ./","perf":"cross-env BABEL_ENV=es babel ./test/perf/index.ts --out-file ./test/perf/index.mjs --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/index.mjs","test":"NODE_ENV=test ts-mocha --exit","build":"npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs build:umd:browser","clean":"rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' ./dist ./types","prepack":"copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .","build:es":"cross-env BABEL_ENV=es babel src --out-dir src --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'","lint:fix":"eslint ./ --fix","postpack":"rimraf NOTICE LICENSES","build:cjs":"cross-env BABEL_ENV=cjs babel src --out-dir src --extensions '.ts' --out-file-extension '.cjs' --root-mode 'upward'","build:umd:browser":"cross-env BABEL_ENV=browser webpack --config config/webpack/browser.config.js --progress","typescript:check-types":"tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit","typescript:declaration":"tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json","perf:openapi-3-1-dereference":"cross-env BABEL_ENV=es babel ./test/perf/openapi-3-1-dereference.ts --out-file ./test/perf/openapi-3-1-dereference.mjs --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/openapi-3-1-dereference.mjs"},"_npmUser":{"name":"swagger-api","email":"apiteam@swagger.io"},"repository":{"url":"git+https://github.com/swagger-api/apidom.git","type":"git"},"_npmVersion":"lerna/9.0.3/node@v22.14.0+x64 (linux)","description":"Advanced algorithms for semantic ApiDOM manipulations like dereferencing or resolution.","directories":{},"sideEffects":["./src/configuration/saturated.mjs","./src/configuration/saturated.cjs"],"_nodeVersion":"22.14.0","dependencies":{"axios":"^1.12.2","ramda":"~0.30.0","process":"^0.11.10","minimatch":"^7.4.3","@types/ramda":"~0.30.0","ramda-adjunct":"^5.0.0","@babel/runtime-corejs3":"^7.26.10","@swagger-api/apidom-core":"^1.1.0","@swagger-api/apidom-error":"^1.1.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"axios-mock-adapter":"^2.0.0","@swagger-api/apidom-ns-arazzo-1":"*","@swagger-api/apidom-json-pointer":"*","@swagger-api/apidom-ns-openapi-2":"*","@swagger-api/apidom-ns-asyncapi-2":"*","@swagger-api/apidom-ns-openapi-3-0":"*","@swagger-api/apidom-ns-openapi-3-1":"*","@swagger-api/apidom-parser-adapter-json":"*","@swagger-api/apidom-parser-adapter-yaml-1-2":"*","@swagger-api/apidom-parser-adapter-arazzo-json-1":"*","@swagger-api/apidom-parser-adapter-arazzo-yaml-1":"*","@swagger-api/apidom-parser-adapter-openapi-json-2":"*","@swagger-api/apidom-parser-adapter-openapi-yaml-2":"*","@swagger-api/apidom-parser-adapter-asyncapi-json-2":"*","@swagger-api/apidom-parser-adapter-asyncapi-json-3":"*","@swagger-api/apidom-parser-adapter-asyncapi-yaml-2":"*","@swagger-api/apidom-parser-adapter-asyncapi-yaml-3":"*","@swagger-api/apidom-parser-adapter-openapi-json-3-0":"*","@swagger-api/apidom-parser-adapter-openapi-json-3-1":"*","@swagger-api/apidom-parser-adapter-openapi-yaml-3-0":"*","@swagger-api/apidom-parser-adapter-openapi-yaml-3-1":"*","@swagger-api/apidom-parser-adapter-api-design-systems-json":"*","@swagger-api/apidom-parser-adapter-api-design-systems-yaml":"*"},"optionalDependencies":{"@swagger-api/apidom-ns-arazzo-1":"^1.1.0","@swagger-api/apidom-json-pointer":"^1.1.0","@swagger-api/apidom-ns-openapi-2":"^1.1.0","@swagger-api/apidom-ns-asyncapi-2":"^1.1.0","@swagger-api/apidom-ns-openapi-3-0":"^1.1.0","@swagger-api/apidom-ns-openapi-3-1":"^1.1.0","@swagger-api/apidom-parser-adapter-json":"^1.1.0","@swagger-api/apidom-parser-adapter-yaml-1-2":"^1.1.0","@swagger-api/apidom-parser-adapter-arazzo-json-1":"^1.1.0","@swagger-api/apidom-parser-adapter-arazzo-yaml-1":"^1.1.0","@swagger-api/apidom-parser-adapter-openapi-json-2":"^1.1.0","@swagger-api/apidom-parser-adapter-openapi-yaml-2":"^1.1.0","@swagger-api/apidom-parser-adapter-asyncapi-json-2":"^1.1.0","@swagger-api/apidom-parser-adapter-asyncapi-json-3":"^1.1.0","@swagger-api/apidom-parser-adapter-asyncapi-yaml-2":"^1.1.0","@swagger-api/apidom-parser-adapter-asyncapi-yaml-3":"^1.1.0","@swagger-api/apidom-parser-adapter-openapi-json-3-0":"^1.1.0","@swagger-api/apidom-parser-adapter-openapi-json-3-1":"^1.1.0","@swagger-api/apidom-parser-adapter-openapi-yaml-3-0":"^1.1.0","@swagger-api/apidom-parser-adapter-openapi-yaml-3-1":"^1.1.0","@swagger-api/apidom-parser-adapter-api-design-systems-json":"^1.1.0","@swagger-api/apidom-parser-adapter-api-design-systems-yaml":"^1.1.0"},"_npmOperationalInternal":{"tmp":"tmp/apidom-reference_1.1.0_1766129574034_0.32418082014377037","host":"s3://npm-registry-packages-npm-production"},"readme":"# @swagger-api/apidom-reference\n\n`@swagger-api/apidom-reference` package contains advanced algorithms for semantic ApiDOM manipulations.\nThis package is divided into three (3) main components:\n\n- **[Parse component](#parse-component)**\n- **[Resolve component](#resolve-component)**\n- **[Dereference component](#dereference-component)**\n- **[Bundle component](#bundle-component)**\n\n## Installation\n\nAfter [prerequisites](https://github.com/swagger-api/apidom/blob/main/README.md#prerequisites) for installing this package are satisfied, you can install it\nvia [npm CLI](https://docs.npmjs.com/cli) by running the following command:\n\n```sh\n $ npm install @swagger-api/apidom-reference\n```\n\n## Configurations\n\nThis package has two main exports suitable for different use-cases. **Empty** configuration and **saturated** configuration.\n\n### Empty configuration\n\n```js\nimport { parse } from '@swagger-api/apidom-reference/configuration/empty';\nimport OpenAPIJSON3_1Parser from '@swagger-api/apidom-reference/parse/parsers/openapi-json-3-1';\n\nawait parse('/home/user/oas.json', {\n  parse: {\n    mediaType: 'application/vnd.oai.openapi+json;version=3.1.0',\n    parsers: [new OpenAPIJSON3_1Parser({ allowEmpty: true, sourceMap: false })]\n  }\n});\n```\n\nWhen using this approach, `options` object is not configured with parsers, resolvers or strategies.\nThis is suitable for creating **web bundles** and gives you total control of the contents of your bundles.\n\n### Saturated configuration\n\n```js\nimport { parse } from '@swagger-api/apidom-reference';\n```\nor\n```js\nimport { parse } from '@swagger-api/apidom-reference/configuration/saturaged';\n```\n\nBoth of above imports are equivalent. This approach is suitable for **Node.js** environments.\n`options` object is pre-configured with all the parsers, resolvers and strategies.\n\n## Parse component\n\nParse component consists of implementation of default [parser plugins](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers).\nDefaults parser plugin is a specialized wrapper that wraps one of the ApiDOM parser adapter into specialized API.\nStandard ApiDOM parser adapter can only parse strings. Parser plugins are capable of parsing local filesystem URIs and network URLs.\n\n**Parsing a file localed on local filesystem:**\n\n```js\nimport { parse } from '@swagger-api/apidom-reference';\n\nawait parse('/home/user/oas.json', {\n  parse: { mediaType: 'application/vnd.oai.openapi+json;version=3.1.0' }\n});\n```\n\n**Parsing an HTTP(S) URL located on internet:**\n\n```js\nimport { parse } from '@swagger-api/apidom-reference';\n\nawait parse('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.json', {\n  parse: { mediaType: 'application/vnd.oai.openapi+json;version=3.1.0' }\n})\n```\n\nNotice how we explicitly pass a `mediaType` parse option. This option is actually **not required**,\nbut if not provided, the Parse component will try to identify appropriate parser plugin by file contents, and it's extension (`.json`).\n\nWhat actually happens if you don't provide `mediaType` parse option?\n\n```js\nimport { parse } from '@swagger-api/apidom-reference';\n\nawait parse('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.json');\n```\n\nThe result of this operation is going to be generic ApiDOM structure. By analyzing the name of the file\nwe can identify the extension of the file as `.json`. At this point we only know\nthat this file is probably going to contain JSON string, though we have no idea what data (AsyncApi/OpenApi)\nis encoded within that JSON string.\n\nIn the future, we will introduce smart algorithms for looking in the contents of a file and detecting the\n`mediaType` automatically. Of course not explicitly providing `mediaType` has performance implications (running detection)\nso providing it is always a better option.\n\n### Parser plugins\n\nParse component comes with number of default parser plugins.\n\n#### [apidom-json](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/apidom-json)\n\nParses dehydrated ApiDOM structure and hydrates it.\nThis parser plugin is uniquely identified by `apidom-json` name.\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.apidom',\n  'application/vnd.apidom+json',\n]\n```\n\n#### [openapi-json-2](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/openapi-json-2)\n\nWraps [@swagger-api/apidom-parser-adapter-openapi-json-2](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-openapi-json-2) package\nand is uniquely  identified by `openapi-json-2` name.\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.oai.openapi;version=2.0',\n  'application/vnd.oai.openapi+json;version=2.0',\n]\n```\n\n#### [openapi-json-3-0](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/openapi-json-3-0)\n\nWraps [@swagger-api/apidom-parser-adapter-openapi-json-3-0](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-openapi-json-3-0) package\nand is uniquely  identified by `openapi-json-3-0` name.\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.oai.openapi;version=3.0.0',\n  'application/vnd.oai.openapi+json;version=3.0.0',\n  'application/vnd.oai.openapi;version=3.0.1',\n  'application/vnd.oai.openapi+json;version=3.0.1',\n  'application/vnd.oai.openapi;version=3.0.2',\n  'application/vnd.oai.openapi+json;version=3.0.2',\n  'application/vnd.oai.openapi;version=3.0.3',\n  'application/vnd.oai.openapi+json;version=3.0.3',\n  'application/vnd.oai.openapi;version=3.0.4',\n  'application/vnd.oai.openapi+json;version=3.0.4',\n]\n```\n\n#### [openapi-yaml-2](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/openapi-yaml-2)\n\nWraps [@swagger-api/apidom-parser-adapter-openapi-yaml-2](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-openapi-yaml-2) package\nand is uniquely  identified by `openapi-yaml-2` name.\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.oai.openapi;version=2.0',\n  'application/vnd.oai.openapi+yaml;version=2.0',\n]\n```\n\n#### [openapi-yaml-3-0](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/openapi-yaml-3-0)\n\nWraps [@swagger-api/apidom-parser-adapter-openapi-yaml-3-0](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-openapi-yaml-3-0) package\nand is uniquely  identified by `openapi-yaml-3-0` name.\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.oai.openapi;version=3.0.0',\n  'application/vnd.oai.openapi+yaml;version=3.0.0',\n  'application/vnd.oai.openapi;version=3.0.1',\n  'application/vnd.oai.openapi+yaml;version=3.0.1',\n  'application/vnd.oai.openapi;version=3.0.2',\n  'application/vnd.oai.openapi+yaml;version=3.0.2',\n  'application/vnd.oai.openapi;version=3.0.3',\n  'application/vnd.oai.openapi+yaml;version=3.0.3',\n  'application/vnd.oai.openapi;version=3.0.4',\n  'application/vnd.oai.openapi+yaml;version=3.0.4',\n]\n```\n\n#### [openapi-json-3-1](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/openapi-json-3-1)\n\nWraps [@swagger-api/apidom-parser-adapter-openapi-json-3-1](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-openapi-json-3-1) package\nand is uniquely  identified by `openapi-json-3-1` name.\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.oai.openapi;version=3.1.0',\n  'application/vnd.oai.openapi+json;version=3.1.0',\n]\n```\n\n#### [openapi-yaml-3-1](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/openapi-yaml-3-1)\n\nWraps [@swagger-api/apidom-parser-adapter-openapi-yaml-3-1](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-openapi-yaml-3-1) package\nand is uniquely  identified by `openapi-yaml-3-1` name.\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.oai.openapi;version=3.1.0',\n  'application/vnd.oai.openapi+yaml;version=3.1.0',\n]\n```\n\n#### [asyncapi-json-2](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/asyncapi-json-2)\n\nWraps [@swagger-api/apidom-parser-adapter-asyncapi-json-2](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-asyncapi-json-2) package\nand is uniquely identified by `asyncapi-json-2` name.\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.aai.asyncapi;version=2.0.0',\n  'application/vnd.aai.asyncapi;version=2.1.0',\n  'application/vnd.aai.asyncapi;version=2.2.0',\n  'application/vnd.aai.asyncapi;version=2.3.0',\n  'application/vnd.aai.asyncapi;version=2.4.0',\n  'application/vnd.aai.asyncapi;version=2.5.0',\n  'application/vnd.aai.asyncapi;version=2.6.0',\n  'application/vnd.aai.asyncapi+json;version=2.0.0',\n  'application/vnd.aai.asyncapi+json;version=2.1.0',\n  'application/vnd.aai.asyncapi+json;version=2.2.0',\n  'application/vnd.aai.asyncapi+json;version=2.3.0',\n  'application/vnd.aai.asyncapi+json;version=2.4.0',\n  'application/vnd.aai.asyncapi+json;version=2.5.0',\n  'application/vnd.aai.asyncapi+json;version=2.6.0',\n]\n```\n\n#### [asyncapi-yaml-2](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/asyncapi-yaml-2)\n\nWraps [@swagger-api/apidom-parser-adapter-asyncapi-yaml-2](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-asyncapi-yaml-2) package\nand is uniquely  identified by `asyncapi-yaml-2` name.\n\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.aai.asyncapi;version=2.0.0',\n  'application/vnd.aai.asyncapi;version=2.1.0',\n  'application/vnd.aai.asyncapi;version=2.2.0',\n  'application/vnd.aai.asyncapi;version=2.3.0',\n  'application/vnd.aai.asyncapi;version=2.3.0',\n  'application/vnd.aai.asyncapi;version=2.4.0',\n  'application/vnd.aai.asyncapi;version=2.5.0',\n  'application/vnd.aai.asyncapi;version=2.6.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.0.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.1.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.2.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.3.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.4.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.5.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.6.0',\n]\n```\n\n#### [asyncapi-json-3](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/asyncapi-json-3)\n\nWraps [@swagger-api/apidom-parser-adapter-asyncapi-json-3](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-asyncapi-json-3) package\nand is uniquely identified by `asyncapi-json-3` name.\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.aai.asyncapi;version=3.0.0',\n  'application/vnd.aai.asyncapi;version=3.1.0',\n  'application/vnd.aai.asyncapi+json;version=3.0.0',\n  'application/vnd.aai.asyncapi+json;version=3.1.0',\n]\n```\n\n#### [asyncapi-yaml-3](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/asyncapi-yaml-3)\n\nWraps [@swagger-api/apidom-parser-adapter-asyncapi-yaml-3](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-asyncapi-yaml-3) package\nand is uniquely identified by `asyncapi-yaml-3` name.\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.aai.asyncapi;version=3.0.0',\n  'application/vnd.aai.asyncapi;version=3.1.0',\n  'application/vnd.aai.asyncapi+yaml;version=3.0.0',\n  'application/vnd.aai.asyncapi+yaml;version=3.1.0',\n]\n```\n\n#### [arazzo-json-1](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/arazzo-json-1)\n\nWraps [@swagger-api/apidom-parser-adapter-arazzo-json-1](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-arazzo-json-1) package\nand is uniquely identified by `arazzo-json-1` name.\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.oai.workflows;version=1.0.0',\n  'application/vnd.oai.workflows+json;version=1.0.0',\n  'application/vnd.oai.workflows;version=1.0.1',\n  'application/vnd.oai.workflows+json;version=1.0.1',\n]\n```\n\n#### [arazzo-yaml-1](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/arazzo-yaml-1)\n\nWraps [@swagger-api/apidom-parser-adapter-arazzo-yaml-1](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-arazzo-yaml-1) package\nand is uniquely identified by `arazzo-yaml-1` name.\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.oai.workflows;version=1.0.0',\n  'application/vnd.oai.workflows+yaml;version=1.0.0',\n  'application/vnd.oai.workflows;version=1.0.1',\n  'application/vnd.oai.workflows+yaml;version=1.0.1',\n]\n```\n\n#### [api-design-systems-json](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/api-design-systems-json)\n\nWraps [@swagger-api/apidom-parser-adapter-api-design-systsems-json](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-api-design-systems-json) package\nand is uniquely identified by `api-design-systems-json` name.\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.aai.apidesignsystems;version=2021-05-07',\n  'application/vnd.aai.apidesignsystems+json;version=2021-05-07'\n]\n```\n\n#### [api-design-systems-yaml](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/api-design-systems-yaml)\n\nWraps [@swagger-api/apidom-parser-adapter-api-design-systems-yaml](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-api-design-systems-yaml) package\nand is uniquely  identified by `api-design-systems-yaml` name.\n\n\nSupported media types are:\n\n```js\n[\n  'application/vnd.aai.apidesignsystems;version=2021-05-07',\n  'application/vnd.aai.apidesignsystems+yaml;version=2021-05-07'\n]\n```\n\n#### [json](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/json)\n\nWraps [@swagger-api/apidom-parser-adapter-json](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-json) package\nand is uniquely  identified by `json` name.\n\n\nSupported media types are:\n\n```js\n[\n  'application/json'\n]\n```\n\n#### [yaml-1-2](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/yaml-1-2)\n\nWraps [@swagger-api/apidom-parser-adapter-yaml-1-2](https://github.com/swagger-api/apidom/tree/main/packages/apidom-parser-adapter-yaml-1-2) package\nand is uniquely  identified by `yaml-1-2` name.\n\n\nSupported media types are:\n\n```js\n[\n  'text/yaml',\n  'application/yaml'\n]\n```\n\n#### [binary](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/parse/parsers/binary)\n\nCan parse any binary or non-binary file and return it's content as `base64` encoded string.\nThis parser is uniquely identified by `binary` name.\n\n\n**All** media types are supported.\n\n#### Parser plugins execution order\n\nIt's important to understand that default parser plugins are run in specific order. The order is determined\nby the [options.parse.parsers](https://github.com/swagger-api/apidom/blob/main/packages/apidom-reference/src/configuration/saturated.ts#L35) option.\nEvery plugin is pulled from `options.parse.parsers` option, and it's `canParse` method is called to determine\nwhether the plugin can parse the URI. If `canParse` returns `true`, `parse` method of plugin is called\nand result from parsing is returned. No subsequent parser plugins are run. If `canParse` returns\n`false`, next parser plugin is pulled and this process is repeated until one of the parser plugins `canParse` method\nreturns `true` or until entire list of parser plugins is exhausted (throws error).\n\n```js\n[\n  new OpenAPIJSON2Parser({ allowEmpty: true, sourceMap: false }),\n  new OpenAPIYAML2Parser({ allowEmpty: true, sourceMap: false }),\n  new OpenAPIJSON3_0Parser({ allowEmpty: true, sourceMap: false }),\n  new OpenAPIYAML3_0Parser({ allowEmpty: true, sourceMap: false }),\n  new OpenAPIJSON3_1Parser({ allowEmpty: true, sourceMap: false }),\n  new OpenAPIYAML3_1Parser({ allowEmpty: true, sourceMap: false }),\n  new AsyncAPIJSON2Parser({ allowEmpty: true, sourceMap: false }),\n  new AsyncAPIYAML2Parser({ allowEmpty: true, sourceMap: false }),\n  new AsyncAPIJSON3Parser({ allowEmpty: true, sourceMap: false }),\n  new AsyncAPIYAML3Parser({ allowEmpty: true, sourceMap: false }),\n  new ArazzoJSON1Parser({ allowEmpty: true, sourceMap: false }),\n  new ArazzoYAML1Parser({ allowEmpty: true, sourceMap: false }),\n  new APIDesignSystemsJSONParser({ allowEmpty: true, sourceMap: false }),\n  new APIDesignSystemsYAMLParser({ allowEmpty: true, sourceMap: false }),\n  new APIDOMJSONParser({ allowEmpty: true, sourceMap: false }),\n  new JSONParser({ allowEmpty: true, sourceMap: false }),\n  new YAMLParser({ allowEmpty: true, sourceMap: false }),\n  new BinaryParser({ allowEmpty: true }),\n]\n```\nMost specific parser plugins are listed first, most generic are listed last.\n\nIt's possible to **change** the parser plugins **order globally** by mutating global `parse` options:\n\n```js\nimport { options } from '@swagger-api/apidom-reference';\nimport OpenAPIJSON2Parser from '@swagger-api/apidom-reference/parse/parsers/openapi-json-2';\nimport OpenAPIYAML2Parser from '@swagger-api/apidom-reference/parse/parsers/openapi-yaml-2';\nimport OpenAPIJSON3_0Parser from '@swagger-api/apidom-reference/parse/parsers/openapi-json-3-0';\nimport OpenAPIYAML3_0Parser from '@swagger-api/apidom-reference/parse/parsers/openapi-yaml-3-0'\nimport OpenAPIJSON3_1Parser from '@swagger-api/apidom-reference/parse/parsers/openapi-json-3-1';\nimport OpenAPIYAML3_1Parser from '@swagger-api/apidom-reference/parse/parsers/openapi-yaml-3-1'\nimport AsyncAPIJSON2Parser from '@swagger-api/apidom-reference/parse/parsers/asyncapi-json-2';\nimport AsyncAPIJSON3Parser from '@swagger-api/apidom-reference/parse/parsers/asyncapi-json-3';\nimport AsyncAPIYAML2Parser from '@swagger-api/apidom-reference/parse/parsers/asyncapi-yaml-2';\nimport AsyncAPIYAML3Parser from '@swagger-api/apidom-reference/parse/parsers/asyncapi-yaml-3';\nimport ArazzoJSON1Parser from '@swagger-api/apidom-reference/parse/parsers/arazzo-json-1';\nimport ArazzoYAML1Parser from '@swagger-api/apidom-reference/parse/parsers/arazzo-yaml-1';\nimport APIDOMJSONParser from '@swagger-api/apidom-reference/parse/parsers/apidom-json';\nimport APIDesignSystemsJSONParser from '@swagger-api/apidom-reference/parse/parsers/api-design-systems-json';\nimport APIDesignSystemsYAMLParser from '@swagger-api/apidom-reference/parse/parsers/api-design-systems-json';\nimport JSONParser from '@swagger-api/apidom-reference/parse/parsers/json';\nimport YAMLParser from '@swagger-api/apidom-reference/parse/parsers/yaml';\nimport BinaryParser from '@swagger-api/apidom-reference/parse/parsers/binary';\n\n\noptions.parse.parsers = [\n  new OpenAPIJSON2Parser({ allowEmpty: true, sourceMap: false }),\n  new OpenAPIYAML2Parser({ allowEmpty: true, sourceMap: false }),\n  new OpenAPIJSON3_0Parser({ allowEmpty: true, sourceMap: false }),\n  new OpenAPIYAML3_0Parser({ allowEmpty: true, sourceMap: false }),\n  new OpenAPIJSON3_1Parser({ allowEmpty: true, sourceMap: false }),\n  new OpenAPIYAML3_1Parser({ allowEmpty: true, sourceMap: false }),\n  new AsyncAPIJSON2Parser({ allowEmpty: true, sourceMap: false }),\n  new AsyncAPIYAML2Parser({ allowEmpty: true, sourceMap: false }),\n  new AsyncAPIJSON3Parser({ allowEmpty: true, sourceMap: false }),\n  new AsyncAPIYAML3Parser({ allowEmpty: true, sourceMap: false }),\n  new ArazzoJSON1Parser({ allowEmpty: true, sourceMap: false }),\n  new ArazzoYAML1Parser({ allowEmpty: true, sourceMap: false }),\n  new APIDesignSystemsJSONParser({ allowEmpty: true, sourceMap: false }),\n  new APIDesignSystemsYAMLParser({ allowEmpty: true, sourceMap: false }),\n  new APIDOMJSONParser({ allowEmpty: true, sourceMap: false }),\n  new YAMLParser({ allowEmpty: true, sourceMap: false }),\n  new JSONParser({ allowEmpty: true, sourceMap: false }),\n  new BinaryParser({ allowEmpty: true }),\n]\n```\n\nTo **change** the parser plugins **order** on ad-hoc basis:\n\n```js\nimport { parse } from '@swagger-api/apidom-reference';\nimport OpenAPIJSON2Parser from '@swagger-api/apidom-reference/parse/parsers/openapi-json-2';\nimport OpenAPIYAML2Parser from '@swagger-api/apidom-reference/parse/parsers/openapi-yaml-2';\nimport OpenAPIJSON3_0Parser from '@swagger-api/apidom-reference/parse/parsers/openapi-json-3-0';\nimport OpenAPIYAML3_0Parser from '@swagger-api/apidom-reference/parse/parsers/openapi-yaml-3-0'\nimport OpenAPIJSON3_1Parser from '@swagger-api/apidom-reference/parse/parsers/openapi-json-3-1';\nimport OpenAPIYAML3_1Parser from '@swagger-api/apidom-reference/parse/parsers/openapi-yaml-3-1'\nimport AsyncAPIJSON2Parser from '@swagger-api/apidom-reference/parse/parsers/asyncapi-json-2';\nimport AsyncAPIJSON3Parser from '@swagger-api/apidom-reference/parse/parsers/asyncapi-json-3';\nimport AsyncAPIYAML2Parser from '@swagger-api/apidom-reference/parse/parsers/asyncapi-yaml-2';\nimport AsyncAPIYAML3Parser from '@swagger-api/apidom-reference/parse/parsers/asyncapi-yaml-3';\nimport ArazzoJSON1Parser from '@swagger-api/apidom-reference/parse/parsers/arazzo-json-1';\nimport ArazzoYAML1Parser from '@swagger-api/apidom-reference/parse/parsers/arazzo-yaml-1';\nimport APIDOMJSONParser from '@swagger-api/apidom-reference/parse/parsers/apidom-json';\nimport APIDesignSystemsJSONParser from '@swagger-api/apidom-reference/parse/parsers/api-design-systems-json';\nimport APIDesignSystemsYAMLParser from '@swagger-api/apidom-reference/parse/parsers/api-design-systems-json';\nimport JSONParser from '@swagger-api/apidom-reference/parse/parsers/json';\nimport YAMLParser from '@swagger-api/apidom-reference/parse/parsers/yaml';\nimport BinaryParser from '@swagger-api/apidom-reference/parse/parsers/binary';\n\nawait parse('/home/user/oas.json', {\n  parse: {\n    mediaType: 'application/vnd.oai.openapi+json;version=3.1.0',\n    parsers: [\n      new OpenAPIJSON2Parser({ allowEmpty: true, sourceMap: false }),\n      new OpenAPIYAML2Parser({ allowEmpty: true, sourceMap: false }),\n      new OpenAPIJSON3_0Parser({ allowEmpty: true, sourceMap: false }),\n      new OpenAPIYAML3_0Parser({ allowEmpty: true, sourceMap: false }),\n      new OpenAPIJSON3_1Parser({ allowEmpty: true, sourceMap: false }),\n      new OpenAPIYAML3_1Parser({ allowEmpty: true, sourceMap: false }),\n      new AsyncAPIJSON2Parser({ allowEmpty: true, sourceMap: false }),\n      new AsyncAPIYAML2Parser({ allowEmpty: true, sourceMap: false }),\n      new AsyncAPIJSON3Parser({ allowEmpty: true, sourceMap: false }),\n      new AsyncAPIYAML3Parser({ allowEmpty: true, sourceMap: false }),\n      new ArazzoJSON1Parser({ allowEmpty: true, sourceMap: false }),\n      new ArazzoYAML1Parser({ allowEmpty: true, sourceMap: false }),\n      new APIDesignSystemsJSONParser({ allowEmpty: true, sourceMap: false }),\n      new APIDesignSystemsYAMLParser({ allowEmpty: true, sourceMap: false }),\n      new APIDOMJSONParser({ allowEmpty: true, sourceMap: false }),\n      new JSONParser({ allowEmpty: true, sourceMap: false }),\n      new YAMLParser({ allowEmpty: true, sourceMap: false }),\n      new BinaryParser({ allowEmpty: true }),\n    ],\n  },\n});\n```\n\n#### Parser plugin options\n\nParser plugins accept additional options like `allowEmpty` or `sourceMap`. It's possible to **change** parser plugin\n**options globally** by mutating global `parse` options:\n\n```js\nimport { options, parse } from '@swagger-api/apidom-reference';\n\noptions.parser.parserOpts = {\n  allowEmpty: false,\n  sourceMap: true,\n};\n\nawait parse('/home/user/oas.json', {\n  parse: { mediaType: 'application/vnd.oai.openapi+json;version=3.1.0' }\n});\n```\n\nTo **change** the parser plugins **options** on ad-hoc basis:\n\n```js\nimport { parse } from '@swagger-api/apidom-reference';\n\nawait parse('/home/user/oas.json', {\n  parse: {\n    mediaType: 'application/vnd.oai.openapi+json;version=3.1.0',\n    parserOpts: { allowEmpty: false, sourceMap: true },\n  },\n});\n```\n\n### Creating new parser plugin\n\nParse component can be extended by additional parser plugins. Every parser plugin is an object that\nmust conform to the following interface/shape:\n\n```typescript\ninterface ParserPlugin {\n  // uniquely identifies this parser plugin\n  readonly name: string;\n  allowEmpty: boolean;\n  sourceMap: boolean;\n  fileExtensions: string[];\n  mediaTypes: string[];\n\n  // this method is called to determine whether the parser plugin can parse the file\n  canParse(file: File): boolean | Promise<boolean>;\n\n  // this method actually parses the file\n  parse(file: File): ParseResultElement | Promise<ParseResultElement>;\n}\n```\n\nNew parser plugin is then provided as an option to a `parse` function:\n\n```ts\nimport { parse, options, File, Parser, ParserOptions } from '@swagger-api/apidom-reference';\n\ninterface MyCustomParserPluginOptions extends Omit<ParserOptions, 'name'> {}\n\nclass MyCustomParserPlugin extends Parser {\n  constructor(options?: MyCustomParserPluginOptions) {\n    super({ ...(options ?? {}), name: 'my-custom-parser' });\n  }\n\n  async canParse(file: File, options: typeof options) {\n    return true;\n  }\n\n  async parse(file: File, options: typeof options) {\n    // implementation of parsing\n  }\n}\n\nawait parse('/home/user/oas.json', {\n  parse: {\n    mediaType: 'application/vnd.oai.openapi+json;version=3.1.0',\n    parsers: [...options.parse.parsers, new MyCustomParserPlugin()],\n  }\n});\n```\n\nIn this particular example we're adding our custom parser plugin as the last plugin\nto the available default parser plugin list, so there's a good chance that one of the\ndefault parser plugins detects that it can parse the `/home/user/oas.json` file,\nparses it and returns.\n\nIf you want to force execution of your custom plugin, add it as a first parser plugin:\n\n```ts\nimport { parse, options, File, Parser, ParserOptions } from '@swagger-api/apidom-reference';\n\ninterface MyCustomParserPluginOptions extends Omit<ParserOptions, 'name'> {}\n\nclass MyCustomParserPlugin extends Parser {\n  constructor(options?: MyCustomParserPluginOptions) {\n    super({ ...(options ?? {}), name: 'my-custom-parser' });\n  }\n\n  async canParse(file: File, options: typeof options) {\n    return true;\n  }\n\n  async parse(file: File, options: typeof options) {\n    // implementation of parsing\n  }\n}\n\n\nawait parse('/home/user/oas.json', {\n  parse: {\n    mediaType: 'application/vnd.oai.openapi+json;version=3.1.0',\n    parsers: [new MyCustomParserPlugin(), ...options.parse.parsers],\n  }\n});\n```\n\nTo override the default parser plugins entirely, set `myCustomParserPlugin` plugin to be the only one available:\n\n```ts\nimport { parse, options, File, Parser, ParserOptions } from '@swagger-api/apidom-reference';\n\ninterface MyCustomParserPluginOptions extends Omit<ParserOptions, 'name'> {}\n\nclass MyCustomParserPlugin extends Parser {\n  constructor(options?: MyCustomParserPluginOptions) {\n    super({ ...(options ?? {}), name: 'my-custom-parser' });\n  }\n\n  async canParse(file: File, options: typeof options) {\n    return true;\n  }\n\n  async parse(file: File, options: typeof options) {\n    // implementation of parsing\n  }\n}\n\nawait parse('/home/user/oas.json', {\n  parse: {\n    mediaType: 'application/vnd.oai.openapi+json;version=3.1.0',\n    parsers: [new MyCustomParserPlugin()],\n  }\n});\n```\n\n### Manipulating parser plugins\n\nParser plugins can be added, removed, replaced or reordered.\n\nHere are two examples of removing one of the parser plugins called `asyncapi-json-2`.\nWe're using the fact that every parser plugin is uniquely identifiable by its name.\n\n**Removing** parser plugin **globally** for all subsequence `parse` calls is achieved by mutating global options:\n\n```js\nimport { parse, options, mergeOptions } from '@swagger-api/apidom-reference';\n\noptions.parse.parsers = options.parse.parsers.filter(parserPlugin => parserPlugin !== 'asyncapi-json-2')\n\n// here you can be sure `asyncapi-json-2` plugin was disabled\nawait parse('/home/user/oas.json', {\n  parse: {\n    mediaType: 'application/vnd.oai.openapi+json;version=3.1.0',\n  }\n});\n```\n\n**Removing** default parser plugin on **ad-hoc** basis:\n\n```js\nimport { parse, options } from '@swagger-api/apidom-reference';\n\nawait parse('/home/user/oas.json', {\n  parse: {\n    mediaType: 'application/vnd.oai.openapi+json;version=3.1.0',\n    parsers: options.parse.parsers.filter(parserPlugin => parserPlugin.name !== 'asyncapi-json-2'),\n  }\n});\n```\nAs you can see, these are all primitive JavaScript Array manipulation techniques.\nThese techniques can be applied to replacing (use [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)) or reordering parser plugins as well.\n\n\n## Resolve component\n\n`Resolve component` consists of two (2) sub-components: **File resolution** and **External Resolution**.\n`Resolve component` is used by [Parse component](#parse-component) under the hood. `Resolve component` provides a resolved\nfile contents for a Parse component to parse.\n\n### File resolution\n\nContains implementation of default [resolver plugins](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/resolve/resolvers).\nDefaults resolver plugin is an object which knows how to obtain contents of a file represented by URI or URL.\n\n#### Resolver plugins\n\nFile resolution comes with two (2) default resolver plugins.\n\n##### [FileResolver](https://github.com/swagger-api/apidom/blob/main/packages/apidom-reference/src/resolve/resolvers/file)\n\nThis resolver plugin is responsible for resolving a local file.\nIt detects if the provided URI represents a filesystem path and if so,\nreads the file and provides its content.\n\n**WARNING**: use this plugin with caution, as it can read files from a local file system.\nBy default, this plugin will reject to read any files from the local file system, unless\nexplicitly provided by **fileAllowList** option.\n\n###### Providing file allow list\n\nFile allow list can be provided **globally** as an option to `FileResolver` in form\nof array of *glob patterns* or *regular expressions*.\n\n```js\nimport { options } from '@swagger-api/apidom-reference';\nimport FileResolver from '@swagger-api/apidom-reference/resolve/resolvers/file';\nimport HTTPResolverAxios from '@swagger-api/apidom-reference/resolve/resolvers/http-axios';\n\noptions.resolve.resolvers = [\n  new FileResolver({\n    fileAllowList: [\n      '*.json',\n      /\\.json$/,\n    ]\n  }),\n  new HTTPResolverAxios({ timeout: 5000, redirects: 5, withCredentials: false }),\n]\n```\n\nFile allow list can also be provided on ad-hoc basis:\n\n```js\nimport { resolve } from '@swagger-api/apidom-reference';\n\nawait resolve('/home/user/oas.json', {\n  resolve: {\n    resolverOpts: {\n      fileAllowList: [\n        '*.json',\n        /\\.json$/,\n      ]\n    },\n  },\n});\n```\n\n###### Caching results from remote files\n\nThe `cacheTTL` option controls caching behavior for files resolved from remote URLs or local filesystem paths. When\nset to a value greater than `0`, resolved file contents are cached using\nthe [Cache Storage API](https://developer.mozilla.org/en-US/docs/Web/API/Cache) for the specified time-to-live (TTL)\nduration in milliseconds.\n\n```js\nimport { resolve } from '@swagger-api/apidom-reference';\n\nawait resolve('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.json', {\n  resolve: {\n    resolverOpts: {\n      cacheTTL: 60 * 1000, // store the result in a cache for 60 seconds\n    },\n  },\n});\n```\n\n##### [HTTPResolverAxios](https://github.com/swagger-api/apidom/blob/main/packages/apidom-reference/src/resolve/resolvers/http-axios)\n\nThis resolver plugin is responsible for resolving a remote file represented by HTTP(s) URL.\nIt detects if the provided URI represents an HTTP(s) URL and if so,\nfetches the file and provides its content.\n\n###### [Axios Request Config](https://axios-http.com/docs/req_config) support\n\nHttpResolverAxios plugin supports all the options available in [Axios Request Config](https://axios-http.com/docs/req_config).\nConfig options can be provided in following way:\n\n```js\nimport { resolve } from '@swagger-api/apidom-reference';\n\nawait resolve('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.json', {\n  resolve: {\n    resolverOpts: {\n      axiosConfig: {\n        timeout: 10000,\n        withCredentials: false,\n        responseType: 'json',\n      },\n    },\n  },\n});\n```\n\n###### [Axios Interceptors](https://axios-http.com/docs/interceptors) support\n\nHttpResolverAxios plugin supports [Axios Interceptors](https://axios-http.com/docs/interceptors).\nInterceptors can be provided in following way:\n\n```js\nimport { resolve } from '@swagger-api/apidom-reference';\n\nconst requestInterceptor = (config) => config;\nconst responseInterceptor = (response) => response;\n\nawait resolve('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.json', {\n  resolve: {\n    resolverOpts: {\n      axiosConfig: {\n        interceptors: {\n          request: requestInterceptor,\n          response: responseInterceptor,\n        },\n      },\n    },\n  },\n});\n```\n\nMultiple request and response interceptors can be provided in following way:\n\n```js\nimport { resolve } from '@swagger-api/apidom-reference';\n\nconst requestInterceptor1 = (config) => config;\nconst requestInterceptor2 = (config) => config;\nconst responseInterceptor1 = (response) => response;\nconst responseInterceptor2 = async (error) => Promise.reject(error);\n\nawait resolve('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.json', {\n  resolve: {\n    resolverOpts: {\n      axiosConfig: {\n        interceptors: {\n          request: [requestInterceptor1, requestInterceptor2],\n          response: [responseInterceptor1, responseInterceptor2],\n        },\n      },\n    },\n  },\n});\n```\n\n**File resolution on local filesystem path**:\n\n```js\nimport { readFile } from '@swagger-api/apidom-reference';\n\nawait readFile('/home/user/oas.json'); // Promise<Buffer>\n```\n\n**File resolution on HTTP(s) URL:**\n\n```js\nimport { readFile } from '@swagger-api/apidom-reference';\n\nawait readFile('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.json'); // Promise<Buffer>\n```\nFile resolution always returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) containing a [Buffer](https://nodejs.org/api/buffer.html).\nIt is responsibility of the API consumer to transform `Buffer` into `String` or any other type.\n\n```js\nimport { readFile } from '@swagger-api/apidom-reference';\n\nconst buffer = await readFile('/home/user/oas.json');\nconst string = buffer.toString('utf-8');\n```\n\n##### Resolver plugins execution order\n\nIt's important to understand that default resolver plugins are run in specific order. The order is determined\nby the [options.resolve.resolvers](https://github.com/swagger-api/apidom/blob/main/packages/apidom-reference/src/configuration/saturated.ts#L56) option.\nEvery plugin is pulled from `options.resolve.resolvers` option, and it's `canRead` method is called to determine\nwhether the plugin can resolve the URI. If `canRead` returns `true`, `read` method of plugin is called\nand result from reading the file is returned. No subsequent resolver plugins are run.\nIf `canRead` returns `false`, next resolver plugin is pulled and this process is repeated until one\nof the resolver plugins `canRead` method returns `true` or until entire list of resolver plugins is exhausted (throws error).\n\n```js\n[\n  new FileResolver(),\n  new HTTPResolverAxios({ timeout: 5000, redirects: 5, withCredentials: false }),\n]\n```\n\nIt's possible to **change** resolver plugins **order globally** by mutating global `resolve` option:\n\n```js\nimport { options } from '@swagger-api/apidom-reference';\nimport FileResolver from '@swagger-api/apidom-reference/resolve/resolvers/file';\nimport HTTPResolverAxios from '@swagger-api/apidom-reference/resolve/resolvers/http-axios';\n\noptions.resolve.resolvers = [\n  new HTTPResolverAxios({ timeout: 5000, redirects: 5, withCredentials: false }),\n  new FileResolver(),\n]\n```\n\nTo **change** resolver plugins **order** on ad-hoc basis:\n\n```js\nimport { readFile } from '@swagger-api/apidom-reference';\nimport FileResolver from '@swagger-api/apidom-reference/resolve/resolvers/file';\nimport HTTPResolverAxios from '@swagger-api/apidom-reference/resolve/resolvers/http-axios';\n\nawait readFile('/home/user/oas.json', {\n  resolve: {\n    resolvers: [\n      new HTTPResolverAxios({ timeout: 5000, redirects: 5, withCredentials: false }),\n      new FileResolver(),\n    ],\n  },\n});\n```\n\n##### Resolver plugin options\n\nSome resolver plugins accept additional options. It's possible to **change** resolver plugin\n**options globally** by mutating global `resolve` options:\n\n```js\nimport { options, readFile } from '@swagger-api/apidom-reference';\n\noptions.resolve.resolverOpts = {\n  axiosConfig: {\n    timeout: 10000,\n  },\n};\n\nawait readFile('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.json');\n```\n\nTo **change** the resolver plugins **options** on ad-hoc basis:\n\n```js\nimport { readFile } from '@swagger-api/apidom-reference';\n\nawait readFile('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.json', {\n  resolve: {\n    resolverOpts: {\n      axiosConfig: {\n        timeout: 10000,\n      },\n    },\n  },\n});\n```\n\nBoth of above examples will be using [HttpResolverAxios](https://github.com/swagger-api/apidom/blob/main/packages/apidom-reference/src/resolve/resolvers/http-axios) plugin\n(as we're trying to resolve HTTP(s) URL) and the `timeout` of resolution will increase from **default 3 seconds**\nto 10 seconds.\n\n##### Resolver strategy plugin options\n\nSome resolver strategy plugins accept additional options. It's possible to **change** strategy plugin\n**options globally** by mutating global `resolve` options:\n\n```js\nimport { options, resolve } from '@swagger-api/apidom-reference';\n\noptions.resolve.strategyOpts = {\n  apidom: { clone: true },\n};\n\nawait resolve('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.json');\n```\n\nTo **change** the resolver strategy plugins **options** on ad-hoc basis:\n\n```js\nimport { resolve } from '@swagger-api/apidom-reference';\n\nawait resolve('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.json', {\n  resolve: {\n    strategyOpts: {\n      apidom: { clone: true },\n    },\n  },\n});\n```\n\n##### Creating new resolver plugin\n\nResolve component can be extended by additional resolver plugins. Every resolver plugin is an object that\nmust conform to the following interface/shape:\n\n```typescript\ninterface ResolverPlugin {\n  // uniquely identifies this plugin\n  readonly name: string;\n\n  // this method is called to determine whether the resolver plugin can resolve the file\n  canRead(file: File, options: ReferenceOptions): boolean;\n  // this method actually resolves the file\n  read(file: File, options: ReferenceOptions): Promise<Buffer>;\n}\n```\n\nNew resolver plugin is then provided as an option to a `readFile` function:\n\n```ts\nimport { readFile, options, File, Resolver, ResolverOptions } from '@swagger-api/apidom-reference';\n\ninterface MyCustomResolverOptions extends Omit<ResolverOptions, 'name'> {}\n\nclass MyCustomResolverPlugin extends Resolver {\n  constructor(options?: MyCustomResolverOptions) {\n    super({ ...(options ?? {}), name: 'my-custom-resolver' });\n  }\n\n  async canRead(file: File, options: typeof options) {\n    return true;\n  }\n\n  async read(file: File, options: typeof options) {\n    // implementation of file resolution\n  }\n}\n\nawait readFile('/home/user/oas.json', {\n  resolve: {\n    resolvers: [...options.resolve.resolvers, new MyCustomResolverPlugin()],\n  }\n});\n```\n\nIn this particular example we're adding our custom resolver plugin as the last plugin\nto the available default resolver plugin list, so there's a good chance that one of the\ndefault resolver plugins detects that it can resolve the `/home/user/oas.json` file,\nresolves it and returns its content.\n\nIf you want to force execution of your custom plugin, add it as a first resolver plugin:\n\n```ts\nimport { readFile, options, File, Resolver, ResolverOptions } from '@swagger-api/apidom-reference';\n\ninterface MyCustomResolverOptions extends Omit<ResolverOptions, 'name'> {}\n\nclass MyCustomResolverPlugin extends Resolver {\n  constructor(options?: MyCustomResolverOptions) {\n    super({ ...(options ?? {}), name: 'my-custom-resolver' });\n  }\n\n  async canRead(file: File, options: typeof options) {\n    return true;\n  }\n\n  async read(file: File, options: typeof options) {\n    // implementation of file resolution\n  }\n}\n\nawait readFile('/home/user/oas.json', {\n  resolve: {\n    resolvers: [new MyCustomResolverPlugin(), ...options.resolve.resolvers],\n  }\n});\n```\n\nTo override the default resolver plugins entirely, set `myCustomResolverPlugin` plugin to be the only one available:\n\n```ts\nimport { readFile, options, File, Resolver, ResolverOptions } from '@swagger-api/apidom-reference';\n\ninterface MyCustomResolverOptions extends Omit<ResolverOptions, 'name'> {}\n\nclass MyCustomResolverPlugin extends Resolver {\n  constructor(options?: MyCustomResolverOptions) {\n    super({ ...(options ?? {}), name: 'my-custom-resolver' });\n  }\n\n  async canRead(file: File, options: typeof options) {\n    return true;\n  }\n\n  async read(file: File, options: typeof options) {\n    // implementation of file resolution\n  }\n}\n\nawait readFile('/home/user/oas.json', {\n  resolve: {\n    resolvers: [new MyCustomResolverPlugin()],\n  }\n});\n```\nNew resolver plugins can be based on two predefined abstract classes: [Resolver](https://github.com/swagger-api/apidom/blob/main/packages/apidom-reference/src/resolve/resolvers/Resolver.ts) and [HTTPResolver](https://github.com/swagger-api/apidom/blob/main/packages/apidom-reference/src/resolve/resolvers/HTTPResolver.ts).\n\n##### Manipulating resolver plugins\n\nResolver plugins can be added, removed, replaced or reordered. We've already covered these techniques in [Manipulating parser plugins section](#manipulating-parser-plugins).\n\n### External resolution\n\nExternal resolution is a process of resolving all external dependencies of a particular\ndocument using a specific [external resolution strategy](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/resolve/strategies). External resolution strategy is determined by\nasserting on `mediaType` option. [File Resolution](#file-resolution) (file content is read/fetched)\nand [Parse component](#parse-component) (file content is parsed) are used under the hood.\n\n**Externally resolving a file localed on a local filesystem:**\n\n```js\nimport { resolve } from '@swagger-api/apidom-reference';\n\nawait resolve('/home/user/oas.json', {\n  parse: { mediType: 'application/vnd.oai.openapi+json;version=3.1.0' },\n}); // Promise<ReferenceSet>\n```\n\n**Externally resolving an HTTP(S) URL located on an internet:**\n\n```js\nimport { resolve } from '@swagger-api/apidom-reference';\n\nawait resolve('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.json', {\n  parse: { mediaType: 'application/vnd.oai.openapi+json;version=3.1.0' },\n  resolve: {\n    resolverOpts: {\n      axiosConfig: {\n        timeout: 10\n      },\n    },\n  },\n}); // Promise<ReferenceSet>\n```\n\n**Externally resolving an ApiDOM fragment:**\n\nWhen externally resolving an ApiDOM fragment, [baseURI](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/options/index.ts#L94)\nresolve option needs to be provided to have a starting point for external dependency resolution.\n`mediaType` parse option is unnecessary as we can directly assert the type of ApiDOM fragment.\n\n```js\nimport { OpenApi3_1Element } from '@swagger-api/apidom-ns-openapi-3-1';\nimport { resolveApiDOM } from '@swagger-api/apidom-reference';\n\nconst apidom = OpenApi3_1Element.refract({\n  openapi: '3.1.0',\n  components: {\n    parameters: {\n      externalRef: {\n        $ref: './ex.json#/externalParameter', // file is located at /home/user/ex.json\n      }\n    }\n  }\n});\n\nconst refSet = await resolveApiDOM(apidom, {\n  resolve: { baseURI: '/home/user/' },\n});\n\nfor (const ref of refSet) {\n  console.log(ref.uri);\n}\n// /home/user\n// /home/user/ex.json\n```\n\n[ReferenceSet](https://github.com/swagger-api/apidom/blob/main/packages/apidom-reference/src/ReferenceSet.ts) is a [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)\nlike structure containing list of [Reference](https://github.com/swagger-api/apidom/blob/main/packages/apidom-reference/src/Reference.ts) objects.\nEvery Reference object represents single external dependency.\n\n#### [External resolution strategies](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/resolve/strategies)\n\nExternal resolution strategy determines how a document is externally resolved. Depending on document `mediaType`\nevery strategy differs significantly. Resolve component comes with two (2) default external resolution strategies.\n\n##### [apidom](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/resolve/strategies/apidom)\n\nExternal resolution strategy for understanding and resolving remote elements referenced with [Ref Element](https://apielements.org/en/latest/element-definitions.html?highlight=referencing#ref-element).\n\nSupported media types:\n\n```js\n[\n  'application/vnd.apidom',\n  'application/vnd.apidom+json'\n]\n```\n\n##### [asyncapi-2](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/resolve/strategies/asyncapi-2)\n\nExternal resolution strategy for understanding and resolving external dependencies of [AsyncApi 2.x.y](https://github.com/asyncapi/spec/blob/v2.6.0/spec/asyncapi.md) definitions.\n\nSupported media types:\n\n```js\n[\n  'application/vnd.aai.asyncapi;version=2.0.0',\n  'application/vnd.aai.asyncapi+json;version=2.0.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.0.0',\n  'application/vnd.aai.asyncapi;version=2.1.0',\n  'application/vnd.aai.asyncapi+json;version=2.1.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.1.0',\n  'application/vnd.aai.asyncapi;version=2.2.0',\n  'application/vnd.aai.asyncapi+json;version=2.2.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.2.0',\n  'application/vnd.aai.asyncapi;version=2.3.0',\n  'application/vnd.aai.asyncapi+json;version=2.3.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.3.0',\n  'application/vnd.aai.asyncapi;version=2.4.0',\n  'application/vnd.aai.asyncapi+json;version=2.4.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.4.0',\n  'application/vnd.aai.asyncapi;version=2.5.0',\n  'application/vnd.aai.asyncapi+json;version=2.5.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.5.0',\n  'application/vnd.aai.asyncapi;version=2.6.0',\n  'application/vnd.aai.asyncapi+json;version=2.6.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.6.0',\n]\n```\n\n##### [openapi-2](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/resolve/strategies/openapi-2)\n\nExternal resolution strategy for understanding and resolving external dependencies of [OpenApi 2.0](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md) definitions.\n\nSupported media types:\n\n```js\n[\n  'application/vnd.oai.openapi;version=2.0',\n  'application/vnd.oai.openapi+json;version=2.0',\n  'application/vnd.oai.openapi+yaml;version=2.0',\n]\n```\n\n##### [openapi-3-0](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/resolve/strategies/openapi-3-0)\n\nExternal resolution strategy for understanding and resolving external dependencies of [OpenApi 3.0.x](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md) definitions.\n\nSupported media types:\n\n```js\n[\n  'application/vnd.oai.openapi;version=3.0.0',\n  'application/vnd.oai.openapi+json;version=3.0.0',\n  'application/vnd.oai.openapi+yaml;version=3.0.0',\n  'application/vnd.oai.openapi;version=3.0.1',\n  'application/vnd.oai.openapi+json;version=3.0.1',\n  'application/vnd.oai.openapi+yaml;version=3.0.1',\n  'application/vnd.oai.openapi;version=3.0.2',\n  'application/vnd.oai.openapi+json;version=3.0.2',\n  'application/vnd.oai.openapi+yaml;version=3.0.2',\n  'application/vnd.oai.openapi;version=3.0.3',\n  'application/vnd.oai.openapi+json;version=3.0.3',\n  'application/vnd.oai.openapi+yaml;version=3.0.3',\n  'application/vnd.oai.openapi;version=3.0.4',\n  'application/vnd.oai.openapi+json;version=3.0.4',\n  'application/vnd.oai.openapi+yaml;version=3.0.4',\n]\n```\n\n##### [openapi-3-1](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/resolve/strategies/openapi-3-1)\n\nExternal resolution strategy for understanding and resolving external dependencies of [OpenApi 3.1.x](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md) definitions.\n\nSupported media types:\n\n```js\n[\n  'application/vnd.oai.openapi;version=3.1.0',\n  'application/vnd.oai.openapi+json;version=3.1.0',\n  'application/vnd.oai.openapi+yaml;version=3.1.0'\n]\n```\n\n##### External resolution strategies execution order\n\nIt's important to understand that default external resolution strategies are run in specific order. The order is determined\nby the [options.resolve.strategies](https://github.com/swagger-api/apidom/blob/main/packages/apidom-reference/src/configuration/saturated.ts#L61) option.\nEvery strategy is pulled from `options.resolve.strategies` option and its `canResolve` method is called to determine\nwhether the strategy can externally resolve the URI. If `canResolve` returns `true`, `resolve` method of strategy is called\nand result from external resolution is returned. No subsequent strategies  are run. If `canResolve` returns\n`false`, next strategy is pulled and this process is repeated until one of the strategy's `canResolve` method\nreturns `true` or until entire list of strategies is exhausted (throws error).\n\n```js\n[\n  new OpenAPI2ResolveStrategy(),\n  new OpenAPI3_0ResolveStrategy(),\n  new OpenAPI3_1ResolveStrategy(),\n  new AsyncAPI2ResolveStrategy(),\n  new ApiDOMResolveStrategy(),\n]\n```\nMost specific strategies are listed first, most generic are listed last.\n\nIt's possible to **change** strategies **order globally** by mutating global `resolve` option:\n\n```js\nimport { options } from '@swagger-api/apidom-reference';\nimport ApiDOMResolveStrategy from '@swagger-api/apidom-reference/resolve/strategies/apidom';\nimport AsyncAPI2ResolveStrategy from '@swagger-api/apidom-reference/resolve/strategies/asyncapi-2';\nimport OpenAPI2ResolveStrategy from '@swagger-api/apidom-reference/resolve/strategies/openapi-2';\nimport OpenAPI3_0ResolveStrategy from '@swagger-api/apidom-reference/resolve/strategies/openapi-3-0';\nimport OpenAPI3_1ResolveStrategy from '@swagger-api/apidom-reference/resolve/strategies/openapi-3-1';\n\noptions.resolve.strategies = [\n  new OpenAPI2ResolveStrategy(),\n  new OpenAPI3_0ResolveStrategy(),\n  new OpenAPI3_1ResolveStrategy(),\n  new AsyncAPI2ResolveStrategy(),\n  new ApiDOMResolveStrategy(),\n];\n```\n\nTo **change** the strategies **order** on ad-hoc basis:\n\n```js\nimport { resolve } from '@swagger-api/apidom-reference';\nimport ApiDOMResolveStrategy from '@swagger-api/apidom-reference/resolve/strategies/apidom';\nimport AsyncAPI2ResolveStrategy from '@swagger-api/apidom-reference/resolve/strategies/asyncapi-2';\nimport OpenAPI2ResolveStrategy from '@swagger-api/apidom-reference/resolve/strategies/openapi-2';\nimport OpenAPI3_0ResolveStrategy from '@swagger-api/apidom-reference/resolve/strategies/openapi-3-0';\nimport OpenAPI3_1ResolveStrategy from '@swagger-api/apidom-reference/resolve/strategies/openapi-3-1';\n\n\nawait resolve('/home/user/oas.json', {\n  parse: {\n    mediaType: 'application/vnd.oai.openapi+json;version=3.1.0',\n  },\n  resolve: {\n    strategies: [\n      new AsyncAPI2ResolveStrategy(),\n      new OpenAPI2ResolveStrategy(),\n      new OpenAPI3_0ResolveStrategy(),\n      new OpenAPI3_1ResolveStrategy(),\n      new ApiDOMResolveStrategy(),\n    ]\n  }\n});\n```\n##### Creating new external resolution strategy\n\nResolve component can be extended by additional strategies. Every strategy is an object that\nmust conform to the following interface/shape:\n\n```typescript\ninterface ResolveStrategy {\n  // uniquely identifies this plugin\n  readonly name: string;\n\n  // this method is called to determine whether the strategy can externally resolve the file\n  canResolve(file: File, options: ReferenceOptions): boolean;\n  // this method actually externally resolves the file\n  resolve(file: File, options: ReferenceOptions): Promise<ReferenceSet>;\n}\n```\n\nNew strategy is then provided as an option to a `resolve` function:\n\n```ts\nimport { resolve, options, File, ResolveStrategy, ResolveStrategyOptions } from '@swagger-api/apidom-reference';\n\ninterface MyCustomResolverStrategyOptions extends Omit<ResolveStrategyOptions, 'name'> {}\n\nclass MyCustomResolverStrategy extends ResolveStrategy {\n  constructor(options?: MyCustomResolverStrategyOptions) {\n    super({ ...(options ?? {}), name: 'my-custom-resolver-strategy' });\n  }\n\n  canResolve(file: File, options: typeof options) {\n    return true;\n  }\n\n  async resolve(file: File, options: typeof options) {\n    // implementation of external resolution\n  }\n}\n\nawait resolve('/home/user/oas.json', {\n  parse: {\n    mediaType: 'application/vnd.oai.openapi+json;version=3.1.0',\n  },\n  resolve: {\n    strategies: [...options.resolve.strategies, new MyCustomResolverStrategy()],\n  }\n});\n```\n\nIn this particular example we're adding our custom strategy as the last strategy\nto the available default external resolution strategy list, so there's a good chance that one of the\ndefault strategies detects that it can externally resolve the `/home/user/oas.json` file,\nresolves it and returns `ReferenceSet` object.\n\nIf you want to force execution of your strategy, add it as a first one:\n\n```ts\nimport { resolve, options, File, ResolveStrategy, ResolveStrategyOptions } from '@swagger-api/apidom-reference';\n\ninterface MyCustomResolverStrategyOptions extends Omit<ResolveStrategyOptions, 'name'> {}\n\nclass MyCustomResolverStrategy extends ResolveStrategy {\n  constructor(options?: MyCustomResolverStrategyOptions) {\n    super({ ...(options ?? {}), name: 'my-custom-resolver-strategy' });\n  }\n\n  canResolve(file: File, options: typeof options) {\n    return true;\n  }\n\n  async resolve(file: File, options: typeof options) {\n    // implementation of external resolution\n  }\n}\n\nawait resolve('/home/user/oas.json', {\n  parse: {\n    mediaType: 'application/vnd.oai.openapi+json;version=3.1.0',\n  },\n  resolve: {\n    strategies: [new MyCustomResolverStrategy(), ...options.resolve.strategies],\n  }\n});\n```\n\nTo override the default strategies entirely, set `MyCustomResolverStrategy` strategy to be the only one available:\n\n```ts\nimport { resolve, options, File, ResolveStrategy, ResolveStrategyOptions } from '@swagger-api/apidom-reference';\n\ninterface MyCustomResolverStrategyOptions extends Omit<ResolveStrategyOptions, 'name'> {}\n\nclass MyCustomResolverStrategy extends ResolveStrategy {\n  constructor(options?: MyCustomResolverStrategyOptions) {\n    super({ ...(options ?? {}), name: 'my-custom-resolver-strategy' });\n  }\n\n  canResolve(file: File, options: typeof options) {\n    return true;\n  }\n\n  async resolve(file: File, options: typeof options) {\n    // implementation of external resolution\n  }\n}\n\nawait resolve('/home/user/oas.json', {\n  parse: {\n    mediaType: 'application/vnd.oai.openapi+json;version=3.1.0',\n  },\n  resolve: {\n    strategies: [new MyCustomResolverPlugin()],\n  }\n});\n```\nNew strategies can be based on a predefined abstract class called [ResolveStrategy](https://github.com/swagger-api/apidom/blob/main/packages/apidom-reference/src/resolve/strategies/ResolveStrategy.ts).\n\n##### Manipulating external resolution strategies\n\nExternal resolution strategies can be added, removed, replaced or reordered. We've already covered these techniques in [Manipulating parser plugins section](#manipulating-parser-plugins).\n\n## Dereference component\n\nDereferencing is a process of transcluding referencing element (internal or external) with a referenced element\nusing a specific [dereference strategy](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/dereference/strategies). Simply put, dereferencing is a process of reference removal.\nDereferencing strategy is determined by asserting on `mediaType` option. [File Resolution](#file-resolution) (file content is read/fetched)\nand [Parse component](#parse-component) (file content is parsed) are used under the hood.\n\n**Dereferencing a file localed on a local filesystem:**\n\n```js\nimport { dereference } from '@swagger-api/apidom-reference';\n\nawait dereference('/home/user/oas.json', {\n  parse: { mediaType: 'application/vnd.oai.openapi+json;version=3.1.0' },\n}); // Promise<ParseResultElement>\n```\n\n**Dereferencing an HTTP(S) URL located on an internet:**\n\n```js\nimport { dereference } from '@swagger-api/apidom-reference';\n\nawait dereference('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.json', {\n  parse: { mediaType: 'application/vnd.oai.openapi+json;version=3.1.0' },\n  resolve: {\n    resolverOpts: {\n      axiosConfig: {\n        timeout: 10\n      },\n    },\n  },\n}); // Promise<ParseResultElement>\n```\n\n**Dereferencing an ApiDOM fragment:**\n\nWhen dereferencing an ApiDOM fragment, [baseURI](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/options/index.ts#L94)\nresolve option needs to be provided to have a starting point for external dependency resolution.\n`mediaType` parse option is unnecessary as we can directly assert the type of ApiDOM fragment.\n\n**ex.json**\n\n```json\n{\n  \"externalParameter\": {\n    \"name\": \"param1\",\n    \"in\": \"query\"\n  }\n}\n```\n\n```js\nimport { OpenApi3_1Element } from '@swagger-api/apidom-ns-openapi-3-1';\nimport { dereferenceApiDOM } from '@swagger-api/apidom-reference';\n\nconst apidom = OpenApi3_1Element.refract({\n  openapi: '3.1.0',\n  components: {\n    parameters: {\n      externalRef: {\n        $ref: './ex.json#/externalParameter', // file is located at /home/user/ex.json\n      }\n    }\n  }\n});\n\nconst dereferenced = await dereferenceApiDOM(apidom, {\n  resolve: { baseURI: '/home/user/' },\n});\n/**\n * OpenApi3_1Element {\n *   openapi: '3.1.0',\n *   components: {\n *     parameters: {\n *       externalRef: {\n *         name: param1,\n *         in: query\n *       }\n *     }\n *   }\n * }\n */\n```\n\n#### [Dereference strategies](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/dereference/strategies)\n\nDereference strategy determines how a document is internally or externally dereferenced. Depending on document `mediaType` option,\nevery strategy differs significantly. `Dereference component` comes with four (4) default dereference strategies.\n\n#### [apidom](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/dereference/strategies/apidom)\n\nDereference strategy for dereferencing ApiDOM using [Ref Element](https://apielements.org/en/latest/element-definitions.html?highlight=referencing#ref-element).\nRef Element MAY be used to reference elements in remote documents or elements in the local document.\nThe ref element transcludes the contents of the element into the document in which it is referenced.\n\nSupported media types:\n\n```js\n[\n  'application/vnd.apidom',\n  'application/vnd.apidom+json',\n]\n```\n\n##### [asyncapi-2](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/dereference/strategies/asyncapi-2)\n\nDereference strategy for dereferencing [AsyncApi 2.x.y](https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md) definitions.\n\nSupported media types:\n\n```js\n[\n  'application/vnd.aai.asyncapi;version=2.0.0',\n  'application/vnd.aai.asyncapi+json;version=2.0.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.0.0',\n  'application/vnd.aai.asyncapi;version=2.1.0',\n  'application/vnd.aai.asyncapi+json;version=2.1.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.1.0',\n  'application/vnd.aai.asyncapi;version=2.2.0',\n  'application/vnd.aai.asyncapi+json;version=2.2.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.2.0',\n  'application/vnd.aai.asyncapi;version=2.3.0',\n  'application/vnd.aai.asyncapi+json;version=2.3.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.3.0',\n  'application/vnd.aai.asyncapi;version=2.4.0',\n  'application/vnd.aai.asyncapi+json;version=2.4.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.4.0',\n  'application/vnd.aai.asyncapi;version=2.5.0',\n  'application/vnd.aai.asyncapi+json;version=2.5.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.5.0',\n  'application/vnd.aai.asyncapi;version=2.6.0',\n  'application/vnd.aai.asyncapi+json;version=2.6.0',\n  'application/vnd.aai.asyncapi+yaml;version=2.6.0',\n]\n```\n\n##### [asyncapi-3](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/dereference/strategies/asyncapi-3)\n\nDereference strategy for dereferencing [AsyncApi 3.x.y](https://github.com/asyncapi/spec/blob/v3.1.0/spec/asyncapi.md) definitions.\n\nSupported media types:\n\n```js\n[\n  'application/vnd.aai.asyncapi;version=3.0.0',\n  'application/vnd.aai.asyncapi+json;version=3.0.0',\n  'application/vnd.aai.asyncapi+yaml;version=3.0.0',\n  'application/vnd.aai.asyncapi;version=3.1.0',\n  'application/vnd.aai.asyncapi+json;version=3.1.0',\n  'application/vnd.aai.asyncapi+yaml;version=3.1.0',\n]\n```\n\n##### [openapi-2](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/dereference/strategies/openapi-2)\n\nDereference strategy for dereferencing [OpenApi 2.0](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md) definitions.\n\nSupported media types:\n\n```js\n[\n  'application/vnd.oai.openapi;version=2.0',\n  'application/vnd.oai.openapi+json;version=2.0',\n  'application/vnd.oai.openapi+yaml;version=2.0',\n]\n```\n\n##### [openapi-3-0](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/dereference/strategies/openapi-3-0)\n\nDereference strategy for dereferencing [OpenApi 3.0.x](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md) definitions.\n\nSupported media types:\n\n```js\n[\n  'application/vnd.oai.openapi;version=3.0.0',\n  'application/vnd.oai.openapi+json;version=3.0.0',\n  'application/vnd.oai.openapi+yaml;version=3.0.0',\n  'application/vnd.oai.openapi;version=3.0.1',\n  'application/vnd.oai.openapi+json;version=3.0.1',\n  'application/vnd.oai.openapi+yaml;version=3.0.1',\n  'application/vnd.oai.openapi;version=3.0.2',\n  'application/vnd.oai.openapi+json;version=3.0.2',\n  'application/vnd.oai.openapi+yaml;version=3.0.2',\n  'application/vnd.oai.openapi;version=3.0.3',\n  'application/vnd.oai.openapi+json;version=3.0.3',\n  'application/vnd.oai.openapi+yaml;version=3.0.3',\n  'application/vnd.oai.openapi;version=3.0.4',\n  'application/vnd.oai.openapi+json;version=3.0.4',\n  'application/vnd.oai.openapi+yaml;version=3.0.4',\n]\n```\n\n##### [openapi-3-1](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/dereference/strategies/openapi-3-1)\n\nDereference strategy for dereferencing [OpenApi 3.1.2](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.2.md) definitions.\n\nSupported media types:\n\n```js\n[\n  'application/vnd.oai.openapi;version=3.1.0',\n  'application/vnd.oai.openapi+json;version=3.1.0',\n  'application/vnd.oai.openapi+yaml;version=3.1.0'\n]\n```\n\n##### Dereference strategies execution order\n\nIt's important to understand that default dereference strategies are run in specific order. The order is determined\nby the [options.dereference.strategies](https://github.com/swagger-api/apidom/blob/main/packages/apidom-reference/src/configuration/saturated.ts#L69) option.\nEvery strategy is pulled from `options.dereference.strategies` option and it's `canDereference` method is called to determine\nwhether the strategy can dereference the URI. If `canDereference` returns `true`, `dereference` method of strategy is called\nand result from dereferencing is returned. No subsequent strategies  are run. If `canDereference` returns\n`false`, next strategy is pulled and this process is repeated until one of the strategy's `canDereference` method\nreturns `true` or until entire list of strategies is exhausted (throws error).\n\n```js\n[\n  new OpenAPI2DereferenceStrategy(),\n  new OpenAPI3_0DereferenceStrategy(),\n  new OpenAPI3_1DereferenceStrategy(),\n  new AsyncAPI2DereferenceStrategy(),\n  new AsyncAPI3DereferenceStrategy(),\n  new ApiDOMDereferenceStrategy(),\n]\n```\nMost specific strategies are listed first, most generic are listed last.\n\nIt's possible to **change** strategies **order globally** by mutating global `dereference` option:\n\n```js\nimport { options } from '@swagger-api/apidom-reference';\nimport AsyncAPI2DereferenceStrategy from '@swagger-api/apidom-reference/dereference/strategies/asyncapi-2';\nimport AsyncAPI3DereferenceStrategy from '@swagger-api/apidom-reference/dereference/strategies/asyncapi-3';\nimport OpenAPI2DereferenceStrategy from '@swagger-api/apidom-reference/dereference/strategies/openapi-2';\nimport OpenAPI3_0DereferenceStrategy from '@swagger-api/apidom-reference/dereference/strategies/openapi-3-0';\nimport OpenAPI3_1DereferenceStrategy from '@swagger-api/apidom-reference/dereference/strategies/openapi-3-1';\nimport ApiDOMDereferenceStrategy from '@swagger-api/apidom-reference/dereference/strategies/apidom';\n\noptions.dereference.strategie","publish_time":1766129574268,"_cnpm_publish_time":1766129574268,"dist-tags":{"latest":"1.14.0","v1.11-maintenance":"1.11.6"}}