diff --git a/package-lock.json b/package-lock.json index 010419a3b2..89f43464a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11584,15 +11584,6 @@ "yarn": ">=1" } }, - "node_modules/cross-fetch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", - "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", - "dev": true, - "dependencies": { - "node-fetch": "2.6.7" - } - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -13919,12 +13910,6 @@ "node": ">=8.6.0" } }, - "node_modules/fast-json-patch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-3.1.1.tgz", - "integrity": "sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ==", - "dev": true - }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -14506,25 +14491,6 @@ "node": ">= 6" } }, - "node_modules/form-data-encoder": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", - "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==", - "dev": true - }, - "node_modules/formdata-node": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", - "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", - "dev": true, - "dependencies": { - "node-domexception": "1.0.0", - "web-streams-polyfill": "4.0.0-beta.3" - }, - "engines": { - "node": ">= 12.20" - } - }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -21356,25 +21322,6 @@ "integrity": "sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA==", "dev": true }, - "node_modules/node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "github", - "url": "https://paypal.me/jimmywarting" - } - ], - "engines": { - "node": ">=10.5.0" - } - }, "node_modules/node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -25073,16 +25020,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==", - "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", - "dev": true, - "engines": { - "node": ">=0.4.x" - } - }, "node_modules/querystringify": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", @@ -28354,36 +28291,6 @@ } } }, - "node_modules/swagger-client": { - "version": "3.18.5", - "resolved": "https://registry.npmjs.org/swagger-client/-/swagger-client-3.18.5.tgz", - "integrity": "sha512-c0txGDtfQTJnaIBaEKCwtRNcUaaAfj+RXI4QVV9p3WW+AUCQqp4naCjaDNNsOfMkE4ySyhnblbL+jGqAVC7snw==", - "dev": true, - "dependencies": { - "@babel/runtime-corejs3": "^7.11.2", - "cookie": "~0.5.0", - "cross-fetch": "^3.1.5", - "deepmerge": "~4.2.2", - "fast-json-patch": "^3.0.0-1", - "form-data-encoder": "^1.4.3", - "formdata-node": "^4.0.0", - "is-plain-object": "^5.0.0", - "js-yaml": "^4.1.0", - "lodash": "^4.17.21", - "qs": "^6.10.2", - "traverse": "~0.6.6", - "url": "~0.11.0" - } - }, - "node_modules/swagger-client/node_modules/is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", @@ -28908,15 +28815,6 @@ "node": ">=12" } }, - "node_modules/traverse": { - "version": "0.6.7", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.7.tgz", - "integrity": "sha512-/y956gpUo9ZNCb99YjxG7OaslxZWHfCHAUUfshwqOXmxUIvqLjVO581BT+gM59+QV9tFe6/CGG53tsA1Y7RSdg==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/tree-sitter": { "version": "0.20.1", "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.20.1.tgz", @@ -29395,16 +29293,6 @@ "punycode": "^2.1.0" } }, - "node_modules/url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha512-kbailJa29QrtXnxgq+DdCEGlbTeYM2eJUxsz6vjZavrCYPMIFHMKQmSKYAIuUK2i7hgPm28a8piX5NTUtM/LKQ==", - "dev": true, - "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" - } - }, "node_modules/url-parse": { "version": "1.5.10", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", @@ -29415,12 +29303,6 @@ "requires-port": "^1.0.0" } }, - "node_modules/url/node_modules/punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==", - "dev": true - }, "node_modules/use-sync-external-store": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", @@ -29633,15 +29515,6 @@ "defaults": "^1.0.3" } }, - "node_modules/web-streams-polyfill": { - "version": "4.0.0-beta.3", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", - "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", - "dev": true, - "engines": { - "node": ">= 14" - } - }, "node_modules/web-tree-sitter": { "version": "0.20.7", "resolved": "https://registry.npmjs.org/web-tree-sitter/-/web-tree-sitter-0.20.7.tgz", @@ -31241,8 +31114,7 @@ "stampit": "=4.3.2" }, "devDependencies": { - "axios-mock-adapter": "=1.21.2", - "swagger-client": "=3.18.5" + "axios-mock-adapter": "=1.21.2" } }, "packages/apidom-reference/node_modules/brace-expansion": { @@ -36954,8 +36826,7 @@ "process": "=0.11.10", "ramda": "=0.28.0", "ramda-adjunct": "=3.4.0", - "stampit": "=4.3.2", - "swagger-client": "=3.18.5" + "stampit": "=4.3.2" }, "dependencies": { "brace-expansion": { @@ -40157,15 +40028,6 @@ "cross-spawn": "^7.0.1" } }, - "cross-fetch": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", - "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", - "dev": true, - "requires": { - "node-fetch": "2.6.7" - } - }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -41875,12 +41737,6 @@ "micromatch": "^4.0.4" } }, - "fast-json-patch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-3.1.1.tgz", - "integrity": "sha512-vf6IHUX2SBcA+5/+4883dsIjpBTqmfBjmYiWK1savxQmFk4JfBMLa7ynTYOs1Rolp/T1betJxHiGD3g1Mn8lUQ==", - "dev": true - }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -42314,22 +42170,6 @@ "mime-types": "^2.1.12" } }, - "form-data-encoder": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-1.7.2.tgz", - "integrity": "sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A==", - "dev": true - }, - "formdata-node": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-4.4.1.tgz", - "integrity": "sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==", - "dev": true, - "requires": { - "node-domexception": "1.0.0", - "web-streams-polyfill": "4.0.0-beta.3" - } - }, "forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -47478,12 +47318,6 @@ "integrity": "sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA==", "dev": true }, - "node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "dev": true - }, "node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -50062,12 +49896,6 @@ "side-channel": "^1.0.4" } }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==", - "dev": true - }, "querystringify": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", @@ -52519,35 +52347,6 @@ "serialize-error": "^10.0.0" } }, - "swagger-client": { - "version": "3.18.5", - "resolved": "https://registry.npmjs.org/swagger-client/-/swagger-client-3.18.5.tgz", - "integrity": "sha512-c0txGDtfQTJnaIBaEKCwtRNcUaaAfj+RXI4QVV9p3WW+AUCQqp4naCjaDNNsOfMkE4ySyhnblbL+jGqAVC7snw==", - "dev": true, - "requires": { - "@babel/runtime-corejs3": "^7.11.2", - "cookie": "~0.5.0", - "cross-fetch": "^3.1.5", - "deepmerge": "~4.2.2", - "fast-json-patch": "^3.0.0-1", - "form-data-encoder": "^1.4.3", - "formdata-node": "^4.0.0", - "is-plain-object": "^5.0.0", - "js-yaml": "^4.1.0", - "lodash": "^4.17.21", - "qs": "^6.10.2", - "traverse": "~0.6.6", - "url": "~0.11.0" - }, - "dependencies": { - "is-plain-object": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", - "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", - "dev": true - } - } - }, "symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", @@ -52946,12 +52745,6 @@ "punycode": "^2.1.1" } }, - "traverse": { - "version": "0.6.7", - "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.6.7.tgz", - "integrity": "sha512-/y956gpUo9ZNCb99YjxG7OaslxZWHfCHAUUfshwqOXmxUIvqLjVO581BT+gM59+QV9tFe6/CGG53tsA1Y7RSdg==", - "dev": true - }, "tree-sitter": { "version": "0.20.1", "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.20.1.tgz", @@ -53296,24 +53089,6 @@ "punycode": "^2.1.0" } }, - "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha512-kbailJa29QrtXnxgq+DdCEGlbTeYM2eJUxsz6vjZavrCYPMIFHMKQmSKYAIuUK2i7hgPm28a8piX5NTUtM/LKQ==", - "dev": true, - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, - "dependencies": { - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==", - "dev": true - } - } - }, "url-parse": { "version": "1.5.10", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", @@ -53506,12 +53281,6 @@ "defaults": "^1.0.3" } }, - "web-streams-polyfill": { - "version": "4.0.0-beta.3", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz", - "integrity": "sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug==", - "dev": true - }, "web-tree-sitter": { "version": "0.20.7", "resolved": "https://registry.npmjs.org/web-tree-sitter/-/web-tree-sitter-0.20.7.tgz", diff --git a/packages/apidom-reference/README.md b/packages/apidom-reference/README.md index 21afff8156..e34d4c8d59 100644 --- a/packages/apidom-reference/README.md +++ b/packages/apidom-reference/README.md @@ -637,38 +637,6 @@ await resolve('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/ }); ``` -##### [HttpResolverSwaggerClient](https://github.com/swagger-api/apidom/blob/main/packages/apidom-reference/src/resolve/resolvers/htt-swagger-client) - -This resolver plugin is responsible for resolving a remote file represented by HTTP(s) URL. -It detects if the provided URI represents an HTTP(s) URL and if so, -fetches the file and provides its content using [SwaggerClient's HTTP Client](https://github.com/swagger-api/swagger-js/blob/master/docs/usage/http-client.md). - -[SwaggerClient npm package](https://www.npmjs.com/package/swagger-client) needs to be installed explicitly before *HttpResolverSwaggerClient* is used. - -```sh - $ npm install --save swagger-client -``` - -SwaggerClient's HTTP Client is then passed to resolver plugin explicitly. - -```js -import { resolve, HttpResolverSwaggerClient } from '@swagger-api/apidom-reference'; -import SwaggerClient from 'swagger-client'; - -await resolve('https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.1/webhook-example.json', { - resolve: { - resolvers: [ - HttpResolverSwaggerClient({ swaggerHTTPClient: SwaggerClient.http }) - ], - resolverOpts: { - swaggerHTTPClientConfig: { - mode: 'cors', - }, - }, - }, -}); -``` - **File resolution on local filesystem path**: ```js @@ -1315,26 +1283,6 @@ Supported media types: ] ``` -##### [openapi-3-1-swagger-client](https://github.com/swagger-api/apidom/tree/main/packages/apidom-reference/src/dereference/strategies/openapi-3-1-swagger-client) - -Dereference strategy for dereferencing [OpenApi 3.1.0](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md) definitions with [swagger-client](https://github.com/swagger-api/swagger-js) flavour. -This strategy support additional options: - -| Option | Description | -|-------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `useCircularStructures` | `Boolean=true`. Prevents circular values from being constructed, unless you specifically want that to happen. If set to `false`, it will leave the circular references unresolved. | - | `allowMetaPatches` | `Boolean=false`. Allows adding meta patches, which include adding `$$refs` to the resolved definition. `$$ref` is a meta information created from the original JSON Reference. | - -Supported media types: - -```js -[ - 'application/vnd.oai.openapi;version=3.1.0', - 'application/vnd.oai.openapi+json;version=3.1.0', - 'application/vnd.oai.openapi+yaml;version=3.1.0' -] -``` - ##### Dereference strategies execution order It's important to understand that default dereference strategies are run in specific order. The order is determined diff --git a/packages/apidom-reference/package.json b/packages/apidom-reference/package.json index 10a183ce47..8a5e5df708 100644 --- a/packages/apidom-reference/package.json +++ b/packages/apidom-reference/package.json @@ -52,11 +52,6 @@ "require": "./cjs/resolve/resolvers/http-axios/index.cjs", "types": "./types/resolve/resolvers/http-axios/index.d.ts" }, - "./resolve/resolvers/http-swagger-client": { - "import": "./es/resolve/resolvers/http-swagger-client/index.js", - "require": "./cjs/resolve/resolvers/http-swagger-client/index.cjs", - "types": "./types/resolve/resolvers/http-swagger-client/index.d.ts" - }, "./resolve/strategies/asyncapi-2": { "import": "./es/resolve/strategies/asyncapi-2/index.js", "require": "./cjs/resolve/strategies/asyncapi-2/index.cjs", @@ -158,11 +153,6 @@ "import": "./es/dereference/strategies/openapi-3-1/selectors/uri/index.js", "require": "./cjs/dereference/strategies/openapi-3-1/selectors/uri/index.cjs", "types": "./types/dereference/strategies/openapi-3-1/selectors/uri/index.d.ts" - }, - "./dereference/strategies/openapi-3-1-swagger-client": { - "import": "./es/dereference/strategies/openapi-3-1-swagger-client/index.js", - "require": "./cjs/dereference/strategies/openapi-3-1-swagger-client/index.cjs", - "types": "./types/dereference/strategies/openapi-3-1-swagger-client/index.d.ts" } }, "imports": { @@ -234,8 +224,7 @@ "stampit": "=4.3.2" }, "devDependencies": { - "axios-mock-adapter": "=1.21.2", - "swagger-client": "=3.18.5" + "axios-mock-adapter": "=1.21.2" }, "files": [ "cjs/", diff --git a/packages/apidom-reference/src/dereference/strategies/openapi-3-1-swagger-client/index.ts b/packages/apidom-reference/src/dereference/strategies/openapi-3-1-swagger-client/index.ts deleted file mode 100644 index f9763d04da..0000000000 --- a/packages/apidom-reference/src/dereference/strategies/openapi-3-1-swagger-client/index.ts +++ /dev/null @@ -1,83 +0,0 @@ -import stampit from 'stampit'; -import { defaultTo, propEq } from 'ramda'; -import { createNamespace, visit, Element } from '@swagger-api/apidom-core'; -import openApi3_1Namespace, { getNodeType, keyMap } from '@swagger-api/apidom-ns-openapi-3-1'; - -import { - DereferenceStrategy as IDereferenceStrategy, - File as IFile, - ReferenceOptions as IReferenceOptions, -} from '../../../types'; -import Reference from '../../../Reference'; -import ReferenceSet from '../../../ReferenceSet'; -import OpenApi3_1SwaggerClientDereferenceVisitor from './visitor'; -import OpenApi3_1DereferenceStrategy from '../openapi-3-1'; - -// @ts-ignore -const visitAsync = visit[Symbol.for('nodejs.util.promisify.custom')]; - -// eslint-disable-next-line @typescript-eslint/naming-convention -interface IOpenApi3_1SwaggerClientDereferenceStrategy extends IDereferenceStrategy { - useCircularStructures: boolean; - allowMetaPatches: boolean; -} - -// eslint-disable-next-line @typescript-eslint/naming-convention -const OpenApi3_1SwaggerClientDereferenceStrategy: stampit.Stamp = - stampit(OpenApi3_1DereferenceStrategy, { - props: { - useCircularStructures: true, - allowMetaPatches: false, - }, - init( - this: IOpenApi3_1SwaggerClientDereferenceStrategy, - { - useCircularStructures = this.useCircularStructures, - allowMetaPatches = this.allowMetaPatches, - } = {}, - ) { - // @ts-ignore - this.name = 'openapi-3-1-swagger-client'; - this.useCircularStructures = useCircularStructures; - this.allowMetaPatches = allowMetaPatches; - }, - methods: { - async dereference(file: IFile, options: IReferenceOptions): Promise { - const namespace = createNamespace(openApi3_1Namespace); - const refSet = defaultTo(ReferenceSet(), options.dereference.refSet); - let reference; - - if (!refSet.has(file.uri)) { - reference = Reference({ uri: file.uri, value: file.parseResult }); - refSet.add(reference); - } else { - // pre-computed refSet was provided as configuration option - reference = refSet.find(propEq('uri', file.uri)); - } - - const visitor = OpenApi3_1SwaggerClientDereferenceVisitor({ - reference, - namespace, - options, - useCircularStructures: this.useCircularStructures, - allowMetaPatches: this.allowMetaPatches, - }); - const dereferencedElement = await visitAsync(refSet.rootRef.value, visitor, { - keyMap, - nodeTypeGetter: getNodeType, - }); - - /** - * Release all memory if this refSet was not provided as a configuration option. - * If provided as configuration option, then provider is responsible for cleanup. - */ - if (options.dereference.refSet === null) { - refSet.clean(); - } - - return dereferencedElement; - }, - }, - }); - -export default OpenApi3_1SwaggerClientDereferenceStrategy; diff --git a/packages/apidom-reference/src/dereference/strategies/openapi-3-1-swagger-client/visitor.ts b/packages/apidom-reference/src/dereference/strategies/openapi-3-1-swagger-client/visitor.ts deleted file mode 100644 index dcd3b2bd67..0000000000 --- a/packages/apidom-reference/src/dereference/strategies/openapi-3-1-swagger-client/visitor.ts +++ /dev/null @@ -1,447 +0,0 @@ -import stampit from 'stampit'; -import { hasIn, pathSatisfies, none } from 'ramda'; -import { isNotUndefined } from 'ramda-adjunct'; -import { - isObjectElement, - ObjectElement, - isPrimitiveElement, - isStringElement, - visit, - Element, -} from '@swagger-api/apidom-core'; -import { evaluate as jsonPointerEvaluate, uriToPointer } from '@swagger-api/apidom-json-pointer'; -import { - getNodeType, - isReferenceLikeElement, - keyMap, - ReferenceElement, - PathItemElement, - SchemaElement, - isReferenceElementExternal, - isPathItemElementExternal, - isBooleanJsonSchemaElement, -} from '@swagger-api/apidom-ns-openapi-3-1'; - -import { - isAnchor, - uriToAnchor, - evaluate as $anchorEvaluate, -} from '../openapi-3-1/selectors/$anchor'; -import { evaluate as uriEvaluate } from '../openapi-3-1/selectors/uri'; -import { Reference as IReference, Resolver as IResolver } from '../../../types'; -import { MaximumDereferenceDepthError } from '../../../util/errors'; -import * as url from '../../../util/url'; -import File from '../../../util/File'; -import { - maybeRefractToSchemaElement, - resolveSchema$refField, -} from '../../../resolve/strategies/openapi-3-1/util'; -import EvaluationJsonSchemaUriError from '../openapi-3-1/selectors/uri/errors/EvaluationJsonSchemaUriError'; -import OpenApi3_1DereferenceVisitor from '../openapi-3-1/visitor'; - -// @ts-ignore -const visitAsync = visit[Symbol.for('nodejs.util.promisify.custom')]; - -// eslint-disable-next-line @typescript-eslint/naming-convention -const OpenApi3_1SwaggerClientDereferenceVisitor = stampit(OpenApi3_1DereferenceVisitor, { - props: { - useCircularStructures: true, - allowMetaPatches: false, - }, - init({ - visited = { - SchemaElement: new WeakSet(), - SchemaElementReference: new WeakSet(), - SchemaElementNoReference: new WeakSet(), - }, - useCircularStructures, - allowMetaPatches, - }) { - this.visited = visited; - this.useCircularStructures = useCircularStructures; - this.allowMetaPatches = allowMetaPatches; - }, - methods: { - async ReferenceElement(referenceElement: ReferenceElement) { - // ignore resolving external Reference Objects - if (!this.options.resolve.external && isReferenceElementExternal(referenceElement)) { - return false; - } - - // @ts-ignore - const reference = await this.toReference(referenceElement.$ref.toValue()); - - this.indirections.push(referenceElement); - - const jsonPointer = uriToPointer(referenceElement.$ref?.toValue()); - - // possibly non-semantic fragment - let fragment = jsonPointerEvaluate(jsonPointer, reference.value.result); - - // applying semantics to a fragment - if (isPrimitiveElement(fragment)) { - const referencedElementType = referenceElement.meta.get('referenced-element').toValue(); - - if (isReferenceLikeElement(fragment)) { - // handling indirect references - fragment = ReferenceElement.refract(fragment); - fragment.setMetaProperty('referenced-element', referencedElementType); - } else { - // handling direct references - const ElementClass = this.namespace.getElementClass(referencedElementType); - fragment = ElementClass.refract(fragment); - } - } - - // detect direct or indirect reference - if (this.indirections.includes(fragment)) { - throw new Error('Recursive JSON Pointer detected'); - } - - // detect maximum depth of dereferencing - if (this.indirections.length > this.options.dereference.maxDepth) { - throw new MaximumDereferenceDepthError( - `Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`, - ); - } - - // dive deep into the fragment - const visitor: any = OpenApi3_1SwaggerClientDereferenceVisitor({ - reference, - namespace: this.namespace, - indirections: [...this.indirections], - options: this.options, - allowMetaPatches: this.allowMetaPatches, - }); - fragment = await visitAsync(fragment, visitor, { keyMap, nodeTypeGetter: getNodeType }); - - fragment = fragment.clone(); - - // annotate fragment with info about original Reference element - fragment.setMetaProperty('ref-fields', { - $ref: referenceElement.$ref?.toValue(), - // @ts-ignore - description: referenceElement.description?.toValue(), - // @ts-ignore - summary: referenceElement.summary?.toValue(), - }); - // annotate fragment with info about origin - fragment.setMetaProperty('ref-origin', reference.uri); - - // override description and summary (outer has higher priority then inner) - const hasDescription = pathSatisfies(isNotUndefined, ['description'], referenceElement); - const hasSummary = pathSatisfies(isNotUndefined, ['summary'], referenceElement); - if (hasDescription && hasIn('description', fragment)) { - // @ts-ignore - fragment.description = referenceElement.description; - } - if (hasSummary && hasIn('summary', fragment)) { - // @ts-ignore - fragment.summary = referenceElement.summary; - } - - // apply meta patches - if (this.allowMetaPatches && isObjectElement(fragment)) { - const objectFragment = fragment as ObjectElement; - // apply meta patch only when not already applied - if (typeof objectFragment.get('$$ref') === 'undefined') { - const absoluteJSONPointerURL = url.resolve( - reference.uri, - referenceElement.$ref?.toValue(), - ); - objectFragment.set('$$ref', absoluteJSONPointerURL); - } - } - - this.indirections.pop(); - - // transclude the element for a fragment - return fragment; - }, - - async PathItemElement(pathItemElement: PathItemElement) { - // ignore PathItemElement without $ref field - if (!isStringElement(pathItemElement.$ref)) { - return undefined; - } - - // ignore resolving external Path Item Elements - if (!this.options.resolve.external && isPathItemElementExternal(pathItemElement)) { - return undefined; - } - - // @ts-ignore - const reference = await this.toReference(pathItemElement.$ref.toValue()); - - this.indirections.push(pathItemElement); - - const jsonPointer = uriToPointer(pathItemElement.$ref?.toValue()); - - // possibly non-semantic referenced element - let referencedElement = jsonPointerEvaluate(jsonPointer, reference.value.result); - - // applying semantics to a referenced element - if (isPrimitiveElement(referencedElement)) { - referencedElement = PathItemElement.refract(referencedElement); - } - - // detect direct or indirect reference - if (this.indirections.includes(referencedElement)) { - throw new Error('Recursive JSON Pointer detected'); - } - - // detect maximum depth of dereferencing - if (this.indirections.length > this.options.dereference.maxDepth) { - throw new MaximumDereferenceDepthError( - `Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`, - ); - } - - // dive deep into the referenced element - const visitor: any = OpenApi3_1SwaggerClientDereferenceVisitor({ - reference, - namespace: this.namespace, - indirections: [...this.indirections], - options: this.options, - allowMetaPatches: this.allowMetaPatches, - }); - referencedElement = await visitAsync(referencedElement, visitor, { - keyMap, - nodeTypeGetter: getNodeType, - }); - - this.indirections.pop(); - - // merge fields from referenced Path Item with referencing one - const mergedResult = new PathItemElement( - // @ts-ignore - [...referencedElement.content], - referencedElement.meta.clone(), - referencedElement.attributes.clone(), - ); - // existing keywords from referencing PathItemElement overrides ones from referenced element - pathItemElement.forEach((value: Element, key: Element, item: Element) => { - mergedResult.remove(key.toValue()); - mergedResult.content.push(item); - }); - mergedResult.remove('$ref'); - - // annotate referenced element with info about original referencing element - mergedResult.setMetaProperty('ref-fields', { - $ref: pathItemElement.$ref?.toValue(), - }); - // annotate referenced element with info about origin - mergedResult.setMetaProperty('ref-origin', reference.uri); - - // apply meta patches - if (this.allowMetaPatches) { - // apply meta patch only when not already applied - if (typeof mergedResult.get('$$ref') === 'undefined') { - const absoluteJSONPointerURL = url.resolve( - reference.uri, - pathItemElement.$ref?.toValue(), - ); - mergedResult.set('$$ref', absoluteJSONPointerURL); - } - } - - // transclude referencing element with merged referenced element - return mergedResult; - }, - - async SchemaElement(referencingElement: SchemaElement) { - /** - * Skip traversal for already visited schemas. - * visit function detects cycles in path automatically. - */ - if (this.visited.SchemaElementNoReference.has(referencingElement)) { - return false; - } - if (this.visited.SchemaElementReference.has(referencingElement)) { - return undefined; - } - - // skip current referencing schema as $ref keyword was not defined - if (!isStringElement(referencingElement.$ref)) { - // mark current referencing schema as visited - this.visited.SchemaElement.add(referencingElement); - this.visited.SchemaElementNoReference.add(referencingElement); - // skip traversing this schema but traverse all it's child schemas - return undefined; - } - - // compute baseURI using rules around $id and $ref keywords - const retrieveURI = this.reference.uri; - const $refBaseURI = resolveSchema$refField(retrieveURI, referencingElement) as string; - const $refBaseURIStrippedHash = url.stripHash($refBaseURI); - const file = File({ uri: $refBaseURIStrippedHash }); - const isUnknownURI = none((r: IResolver) => r.canRead(file), this.options.resolve.resolvers); - const isURL = !isUnknownURI; - const isExternal = isURL && this.reference.uri !== $refBaseURIStrippedHash; - - // ignore resolving external Schema Objects - if (!this.options.resolve.external && isExternal) { - // mark current referencing schema as visited - this.visited.SchemaElement.add(referencingElement); - this.visited.SchemaElementReference.add(referencingElement); - // skip traversing this schema but traverse all it's child schemas - return undefined; - } - - this.indirections.push(referencingElement); - - // determining reference, proper evaluation and selection mechanism - let reference: IReference; - let referencedElement; - - try { - if (isUnknownURI || isURL) { - // we're dealing with canonical URI or URL with possible fragment - reference = this.reference; - const selector = $refBaseURI; - referencedElement = uriEvaluate( - selector, - // @ts-ignore - maybeRefractToSchemaElement(reference.value.result), - ); - } else { - // we're assuming here that we're dealing with JSON Pointer here - reference = await this.toReference(url.unsanitize($refBaseURI)); - const selector = uriToPointer($refBaseURI); - referencedElement = maybeRefractToSchemaElement( - // @ts-ignore - jsonPointerEvaluate(selector, reference.value.result), - ); - } - } catch (error) { - /** - * No SchemaElement($id=URL) was not found, so we're going to try to resolve - * the URL and assume the returned response is a JSON Schema. - */ - if (isURL && error instanceof EvaluationJsonSchemaUriError) { - if (isAnchor(uriToAnchor($refBaseURI))) { - // we're dealing with JSON Schema $anchor here - reference = await this.toReference(url.unsanitize($refBaseURI)); - const selector = uriToAnchor($refBaseURI); - referencedElement = $anchorEvaluate( - selector, - // @ts-ignore - maybeRefractToSchemaElement(reference.value.result), - ); - } else { - // we're assuming here that we're dealing with JSON Pointer here - reference = await this.toReference(url.unsanitize($refBaseURI)); - const selector = uriToPointer($refBaseURI); - referencedElement = maybeRefractToSchemaElement( - // @ts-ignore - jsonPointerEvaluate(selector, reference.value.result), - ); - } - } else { - throw error; - } - } - - // mark current referencing schema as visited - this.visited.SchemaElement.add(referencingElement); - this.visited.SchemaElementReference.add(referencingElement); - - // detect direct or indirect reference - if (this.indirections.includes(referencedElement)) { - throw new Error('Recursive JSON Pointer detected'); - } - - // detect maximum depth of dereferencing - if (this.indirections.length > this.options.dereference.maxDepth) { - throw new MaximumDereferenceDepthError( - `Maximum dereference depth of "${this.options.dereference.maxDepth}" has been exceeded in file "${this.reference.uri}"`, - ); - } - - // detect possible cycle and avoid it - if (!this.useCircularStructures && this.visited.SchemaElement.has(referencedElement)) { - if (url.isHttpUrl(reference.uri) || url.isFileSystemPath(reference.uri)) { - // make the referencing URL or file system path absolute - const absoluteJSONPointerURL = url.resolve( - reference.uri, - referencingElement.$ref?.toValue(), - ); - referencingElement.set('$ref', absoluteJSONPointerURL); - } - // skip processing this schema and all it's child schemas - return false; - } - - // dive deep into the fragment - const visitor: any = OpenApi3_1SwaggerClientDereferenceVisitor({ - reference, - namespace: this.namespace, - indirections: [...this.indirections], - options: this.options, - // SchemaElementReference must be reset for deep dive, as we want to dereference all indirections - visited: { - SchemaElement: this.visited.SchemaElement, - SchemaElementReference: new WeakSet(), - SchemaElementNoReference: this.visited.SchemaElementNoReference, - }, - useCircularStructures: this.useCircularStructures, - allowMetaPatches: this.allowMetaPatches, - }); - referencedElement = await visitAsync(referencedElement, visitor, { - keyMap, - nodeTypeGetter: getNodeType, - }); - - this.indirections.pop(); - - // Boolean JSON Schemas - if (isBooleanJsonSchemaElement(referencedElement)) { - const referencedElementClone = referencedElement.clone(); - // annotate referenced element with info about original referencing element - referencedElementClone.setMetaProperty('ref-fields', { - $ref: referencingElement.$ref?.toValue(), - }); - // annotate referenced element with info about origin - referencedElementClone.setMetaProperty('ref-origin', reference.uri); - return referencedElementClone; - } - - // Schema Object - merge keywords from referenced schema with referencing schema - const mergedResult = new SchemaElement( - // @ts-ignore - [...referencedElement.content], - referencedElement.meta.clone(), - referencedElement.attributes.clone(), - ); - // existing keywords from referencing schema overrides ones from referenced schema - referencingElement.forEach((value: Element, key: Element, item: Element) => { - mergedResult.remove(key.toValue()); - mergedResult.content.push(item); - }); - mergedResult.remove('$ref'); - - // annotate referenced element with info about original referencing element - mergedResult.setMetaProperty('ref-fields', { - $ref: referencingElement.$ref?.toValue(), - }); - // annotate fragment with info about origin - mergedResult.setMetaProperty('ref-origin', reference.uri); - // apply meta patches - if (this.allowMetaPatches) { - // apply meta patch only when not already applied - if (typeof mergedResult.get('$$ref') === 'undefined') { - const absoluteJSONPointerURL = url.resolve( - reference.uri, - referencingElement.$ref?.toValue(), - ); - mergedResult.set('$$ref', absoluteJSONPointerURL); - } - } - - // transclude referencing element with merged referenced element - return mergedResult; - }, - }, -}); - -export default OpenApi3_1SwaggerClientDereferenceVisitor; diff --git a/packages/apidom-reference/src/resolve/resolvers/http-swagger-client/index.ts b/packages/apidom-reference/src/resolve/resolvers/http-swagger-client/index.ts deleted file mode 100644 index b0487c44f9..0000000000 --- a/packages/apidom-reference/src/resolve/resolvers/http-swagger-client/index.ts +++ /dev/null @@ -1,64 +0,0 @@ -import stampit from 'stampit'; - -import ResolverError from '../../../util/errors/ResolverError'; -import { HttpResolver as IHttpResolver, File as IFile } from '../../../types'; -import HttpResolver from '../HttpResolver'; - -interface IHttpResolverSwaggerClient extends IHttpResolver { - swaggerHTTPClient: any; - swaggerHTTPClientConfig: { [key: string]: any }; - - getHttpClient(): any; -} - -const HttpResolverSwaggerClient: stampit.Stamp = stampit(HttpResolver, { - props: { - name: 'http-swagger-client', - swaggerHTTPClient: null, - swaggerHTTPClientConfig: {}, - }, - init(this: IHttpResolverSwaggerClient, { swaggerHTTPClient = this.swaggerHTTPClient }) { - this.swaggerHTTPClient = swaggerHTTPClient; - }, - methods: { - getHttpClient() { - return this.swaggerHTTPClient; - }, - async read(file: IFile): Promise { - const client = this.getHttpClient(); - const controller = new AbortController(); - const { signal } = controller; - const timeoutID = setTimeout(() => { - controller.abort(); - }, this.timeout); - const credentials = - this.getHttpClient()?.withCredentials || this.withCredentials ? 'include' : 'same-origin'; - const redirects = this.redirects === 0 ? 'error' : 'follow'; - const follow = this.redirects > 0 ? this.redirects : undefined; - - try { - const response = await client({ - url: file.uri, - signal, - userFetch: async (resource: string, options: any) => { - const res = await fetch(resource, options); - res.headers.delete('Content-Type'); - return res; - }, - credentials, - redirects, - follow, - ...this.swaggerHTTPClientConfig, - }); - - return response.text.arrayBuffer(); - } catch (error: any) { - throw new ResolverError(`Error downloading "${file.uri}"`, error); - } finally { - clearTimeout(timeoutID); - } - }, - }, -}); - -export default HttpResolverSwaggerClient; diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/bootstrap.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/bootstrap.ts deleted file mode 100644 index ddc3507123..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/bootstrap.ts +++ /dev/null @@ -1,64 +0,0 @@ -// @ts-ignore -import SwaggerClient from 'swagger-client'; - -import options from '../../../../src/options'; -import JsonParser from './helpers/parsers/json'; -import YamlParser from './helpers/parsers/yaml1-2'; -import OpenApiJson3_1Parser from './helpers/parsers/openapi-json-3-1'; -import OpenApiYaml3_1Parser from './helpers/parsers/openapi-yaml-3-1'; -import HttpResolverSwaggerClient from '../../../../src/resolve/resolvers/http-swagger-client'; -import OpenApi3_1SwaggerClientDereferenceStrategy from '../../../../src/dereference/strategies/openapi-3-1-swagger-client'; - -const originalParsers = [...options.parse.parsers]; -const originalResolvers = [...options.resolve.resolvers]; -const originalDereferenceStrategies = [...options.dereference.strategies]; - -export const before = () => { - // configure custom parser plugins globally - options.parse.parsers = options.parse.parsers.map((parser) => { - // @ts-ignore - if (parser.name === 'json') { - return JsonParser({ allowEmpty: true, sourceMap: false }); - } - // @ts-ignore - if (parser.name === 'yaml-1-2') { - return YamlParser({ allowEmpty: true, sourceMap: false }); - } - // @ts-ignore - if (parser.name === 'openapi-json-3-1') { - return OpenApiJson3_1Parser({ allowEmpty: true, sourceMap: false }); - } - // @ts-ignore - if (parser.name === 'openapi-yaml-3-1') { - return OpenApiYaml3_1Parser({ allowEmpty: true, sourceMap: false }); - } - - return parser; - }); - - // configure custom resolver plugins globally - options.resolve.resolvers = options.resolve.resolvers.map((resolver) => { - // @ts-ignore - if (resolver.name === 'http-axios') { - return HttpResolverSwaggerClient({ swaggerHTTPClient: SwaggerClient.http }); - } - - return resolver; - }); - - // configure custom dereference strategy globally - options.dereference.strategies = options.dereference.strategies.map((strategy) => { - // @ts-ignore - if (strategy.name === 'openapi-3-1') { - return OpenApi3_1SwaggerClientDereferenceStrategy(); - } - - return strategy; - }); -}; - -export const after = () => { - options.parse.parsers = originalParsers; - options.resolve.resolvers = originalResolvers; - options.dereference.strategies = originalDereferenceStrategies; -}; diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/fixtures/components-callbacks/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/fixtures/components-callbacks/dereferenced.json deleted file mode 100644 index 4c753eb15c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/fixtures/components-callbacks/dereferenced.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "callbacks": { - "callback1": { - "{$method}": { - "description": "description of callback2" - } - }, - "callback2": { - "{$method}": { - "description": "description of callback2" - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/fixtures/components-callbacks/root.yaml b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/fixtures/components-callbacks/root.yaml deleted file mode 100644 index 93fff754fe..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/fixtures/components-callbacks/root.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -openapi: 3.1.0 -components: - callbacks: - callback1: - "$ref": "#/components/callbacks/callback2" - callback2: - "{$method}": - description: description of callback2 diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/fixtures/operation-object/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/fixtures/operation-object/dereferenced.json deleted file mode 100644 index 9bdc71acaf..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/fixtures/operation-object/dereferenced.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "openapi": "3.1.0", - "paths": { - "/path": { - "get": { - "callbacks": { - "callback": { - "{$method}": { - "description": "description of callback2" - } - } - } - } - } - }, - "components": { - "callbacks": { - "callback": { - "{$method}": { - "description": "description of callback2" - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/fixtures/operation-object/root.yaml b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/fixtures/operation-object/root.yaml deleted file mode 100644 index 0c9162d0f1..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/fixtures/operation-object/root.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -openapi: 3.1.0 -paths: - "/path": - get: - callbacks: - callback: - "$ref": "#/components/callbacks/callback" -components: - callbacks: - callback: - "{$method}": - description: description of callback2 diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/index.ts deleted file mode 100644 index 7f963a4b41..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/callback-object/index.ts +++ /dev/null @@ -1,54 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { toValue } from '@swagger-api/apidom-core'; -import { mediaTypes } from '@swagger-api/apidom-ns-openapi-3-1'; - -import { loadJsonFile } from '../../../../helpers'; -import { dereference } from '../../../../../src'; -import * as bootstrap from '../bootstrap'; - -const rootFixturePath = path.join(__dirname, 'fixtures'); - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Callback Object', function () { - context('given in components/callbacks field', function () { - const fixturePath = path.join(rootFixturePath, 'components-callbacks'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.yaml'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('yaml') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given in Operation Object', function () { - const fixturePath = path.join(rootFixturePath, 'operation-object'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.yaml'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('yaml') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/dereference-apidom.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/dereference-apidom.ts deleted file mode 100644 index 79e2b0d143..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/dereference-apidom.ts +++ /dev/null @@ -1,67 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { - mediaTypes, - ExampleElement, - isExampleElement, - OpenApi3_1Element, -} from '@swagger-api/apidom-ns-openapi-3-1'; -import { evaluate } from '@swagger-api/apidom-json-pointer'; - -import * as bootstrap from '../bootstrap'; -import { parse, dereferenceApiDOM } from '../../../../../src'; - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Example Object', function () { - context('given single ExampleElement passed to dereferenceApiDOM', function () { - const fixturePath = path.join(__dirname, 'fixtures', 'external-value-json', 'root.json'); - - specify('should dereference', async function () { - const parseResult = await parse(fixturePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const exampleElement = evaluate( - '/components/examples/example1', - parseResult.api as OpenApi3_1Element, - ); - const dereferenced = await dereferenceApiDOM(exampleElement, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { baseURI: fixturePath }, - }); - - assert.isTrue(isExampleElement(dereferenced)); - }); - - specify('should dereference and contain metadata about origin', async function () { - const parseResult = await parse(fixturePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const exampleElement = evaluate( - '/components/examples/example1', - parseResult.api as OpenApi3_1Element, - ); - const dereferenced = (await dereferenceApiDOM(exampleElement, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { baseURI: fixturePath }, - })) as ExampleElement; - - assert.match( - dereferenced.value?.meta.get('ref-origin').toValue(), - /external-value-json\/ex\.json$/, - ); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/components-examples/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/components-examples/dereferenced.json deleted file mode 100644 index 810362c752..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/components-examples/dereferenced.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "value": 1 - }, - "example2": { - "description": "example1 description", - "value": 1 - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/components-examples/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/components-examples/root.json deleted file mode 100644 index d7f47b7b3a..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/components-examples/root.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "value": 1 - }, - "example2": { - "$ref": "#/components/examples/example1" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-binary/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-binary/dereferenced.json deleted file mode 100644 index 6390964608..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-binary/dereferenced.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "value": "AAABAAMAEBAAAAEAIABoBAAANgAAACAgAAABACAAKBEAAJ4EAAAwMAAAAQAgAGgmAADGFQAAKAAAABAAAAAgAAAAAQAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOPj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/9PT0/+np6f/rq6u/+Pj4//j4+P/zMzM/8vLy//g4OD/4+Pj/+Pj4//j4+P/4+Pj/+Pj4//j4+P/4+Pj/+Pj4/+0tLT/NTU1/0tLS//j4+P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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", - "externalValue": "./favicon.ico" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-binary/favicon.ico b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-binary/favicon.ico deleted file mode 100644 index 4ffa222883..0000000000 Binary files a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-binary/favicon.ico and /dev/null differ diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-binary/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-binary/root.json deleted file mode 100644 index 8179437c62..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-binary/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "externalValue": "./favicon.ico" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-ignore-external/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-ignore-external/dereferenced.json deleted file mode 100644 index c04d231350..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-ignore-external/dereferenced.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "externalValue": "./ex.json" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-ignore-external/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-ignore-external/ex.json deleted file mode 100644 index 0967ef424b..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-ignore-external/ex.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-ignore-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-ignore-external/root.json deleted file mode 100644 index 2c2d58d639..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-ignore-external/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "externalValue": "./ex.json" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-json/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-json/dereferenced.json deleted file mode 100644 index a5cff2bc14..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-json/dereferenced.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "value": { - "prop1": "value1", - "prop2": "value2" - }, - "externalValue": "./ex.json" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-json/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-json/ex.json deleted file mode 100644 index 6fb8855f8a..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-json/ex.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "prop1": "value1", - "prop2": "value2" -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-json/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-json/root.json deleted file mode 100644 index 2c2d58d639..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-json/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "externalValue": "./ex.json" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-pointer/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-pointer/dereferenced.json deleted file mode 100644 index eae84b99b7..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-pointer/dereferenced.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "value": { - "prop1": "value1", - "prop2": "value2" - }, - "externalValue": "./ex.json#/json/pointer" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-pointer/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-pointer/ex.json deleted file mode 100644 index 6fb8855f8a..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-pointer/ex.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "prop1": "value1", - "prop2": "value2" -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-pointer/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-pointer/root.json deleted file mode 100644 index e5e5883e48..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-pointer/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "externalValue": "./ex.json#/json/pointer" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-text/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-text/dereferenced.json deleted file mode 100644 index ce48fb16f1..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-text/dereferenced.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "value": "dmFsMTt2YWwyO3ZhbDMK", - "externalValue": "./ex.csv" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-text/ex.csv b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-text/ex.csv deleted file mode 100644 index afd194d0e1..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-text/ex.csv +++ /dev/null @@ -1 +0,0 @@ -val1;val2;val3 diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-text/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-text/root.json deleted file mode 100644 index fb347a7767..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-text/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "externalValue": "./ex.csv" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-unresolvable/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-unresolvable/root.json deleted file mode 100644 index 2c2d58d639..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-unresolvable/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "externalValue": "./ex.json" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-value-both-defined/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-value-both-defined/ex.json deleted file mode 100644 index 0967ef424b..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-value-both-defined/ex.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-value-both-defined/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-value-both-defined/root.json deleted file mode 100644 index a63d5e606f..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-value-both-defined/root.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "value": "sample value", - "externalValue": "./ex.json" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-yaml/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-yaml/dereferenced.json deleted file mode 100644 index 1ad8645745..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-yaml/dereferenced.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "value": { - "prop1": "value1", - "prop2": "value2" - }, - "externalValue": "./ex.yaml" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-yaml/ex.yaml b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-yaml/ex.yaml deleted file mode 100644 index 95d4e79f9c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-yaml/ex.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -prop1: value1 -prop2: value2 diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-yaml/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-yaml/root.json deleted file mode 100644 index 54aa18bb2f..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/external-value-yaml/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "examples": { - "example1": { - "description": "example1 description", - "externalValue": "./ex.yaml" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/media-type-object/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/media-type-object/dereferenced.json deleted file mode 100644 index 393ed725de..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/media-type-object/dereferenced.json +++ /dev/null @@ -1,31 +0,0 @@ -[ - { - "openapi": "3.1.0", - "paths": { - "/path": { - "get": { - "responses": { - "201": { - "content": { - "application/json": { - "examples": { - "example1": { - "description": "example 2 description" - } - } - } - } - } - } - } - } - }, - "components": { - "examples": { - "example2": { - "description": "example 2 description" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/media-type-object/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/media-type-object/root.json deleted file mode 100644 index d1b8222953..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/media-type-object/root.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path": { - "get": { - "responses": { - "201": { - "content": { - "application/json": { - "examples": { - "example1": { - "$ref": "#/components/examples/example2" - } - } - } - } - } - } - } - } - }, - "components": { - "examples": { - "example2": { - "description": "example 2 description" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/parameter-object/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/parameter-object/dereferenced.json deleted file mode 100644 index 27d46beaae..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/parameter-object/dereferenced.json +++ /dev/null @@ -1,24 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "param1": { - "name": "offset", - "in": "query", - "required": true, - "examples": { - "example1": { - "description": "example 2 description" - } - } - } - }, - "examples": { - "example2": { - "description": "example 2 description" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/parameter-object/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/parameter-object/root.json deleted file mode 100644 index 1ba502d046..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/fixtures/parameter-object/root.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "param1": { - "name": "offset", - "in": "query", - "required": true, - "examples": { - "example1": { - "$ref": "#/components/examples/example2" - } - } - } - }, - "examples": { - "example2": { - "description": "example 2 description" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/index.ts deleted file mode 100644 index 14c0c8d42d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/example-object/index.ts +++ /dev/null @@ -1,194 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { toValue } from '@swagger-api/apidom-core'; -import { mediaTypes } from '@swagger-api/apidom-ns-openapi-3-1'; - -import { loadJsonFile } from '../../../../helpers'; -import { dereference } from '../../../../../src'; -import { DereferenceError } from '../../../../../src/util/errors'; -import * as bootstrap from '../bootstrap'; - -const rootFixturePath = path.join(__dirname, 'fixtures'); - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Example Object', function () { - context('given in components/examples field', function () { - const fixturePath = path.join(rootFixturePath, 'components-examples'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given in Parameter Object', function () { - const fixturePath = path.join(rootFixturePath, 'parameter-object'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given in Media Type Object', function () { - const fixturePath = path.join(rootFixturePath, 'media-type-object'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given externalValue field', function () { - context('and pointing to a JSON file', function () { - const fixturePath = path.join(rootFixturePath, 'external-value-json'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('and pointing to a JSON file and having JSON Pointer', function () { - const fixturePath = path.join(rootFixturePath, 'external-value-pointer'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('and pointing to a YAML file', function () { - const fixturePath = path.join(rootFixturePath, 'external-value-yaml'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('and pointing to a text file', function () { - const fixturePath = path.join(rootFixturePath, 'external-value-text'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('and pointing to a binary file', function () { - const fixturePath = path.join(rootFixturePath, 'external-value-binary'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('and with unresolvable URI', function () { - const fixturePath = path.join(rootFixturePath, 'external-value-unresolvable'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('with external resolution disabled', function () { - const fixturePath = path.join(rootFixturePath, 'external-value-ignore-external'); - - specify('should not dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { external: false }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given both value and externalValue fields are defined', function () { - const fixturePath = path.join(rootFixturePath, 'external-value-value-both-defined'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (error: any) { - assert.strictEqual( - error.cause.cause.message, - 'ExampleElement value and externalValue fields are mutually exclusive.', - ); - assert.instanceOf(error, DereferenceError); - } - }); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/components-headers/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/components-headers/dereferenced.json deleted file mode 100644 index 83fecb62ce..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/components-headers/dereferenced.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "headers": { - "content-type": { - "description": "content type header description" - }, - "x-custom-header": { - "description": "content type header description" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/components-headers/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/components-headers/root.json deleted file mode 100644 index fe69f04fea..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/components-headers/root.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "headers": { - "content-type": { - "description": "content type header description" - }, - "x-custom-header": { - "$ref": "#/components/headers/content-type" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/encoding-object/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/encoding-object/dereferenced.json deleted file mode 100644 index 33a788b7fe..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/encoding-object/dereferenced.json +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "param1": { - "name": "offset", - "in": "query", - "required": true, - "content": { - "encoding": { - "Encoding": { - "headers": { - "content-type": { - "$ref": "#/components/headers/content-type" - } - } - } - } - } - } - }, - "components": { - "headers": { - "content-type": { - "description": "content type header description" - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/encoding-object/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/encoding-object/root.json deleted file mode 100644 index e3d771e9e6..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/encoding-object/root.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "param1": { - "name": "offset", - "in": "query", - "required": true, - "content": { - "encoding": { - "Encoding": { - "headers": { - "content-type": { - "$ref": "#/components/headers/content-type" - } - } - } - } - } - } - }, - "components": { - "headers": { - "content-type": { - "description": "content type header description" - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/response-object/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/response-object/dereferenced.json deleted file mode 100644 index ddf6b31709..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/response-object/dereferenced.json +++ /dev/null @@ -1,21 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "responses": { - "default": { - "headers": { - "content-type": { - "description": "content type header description" - } - } - } - }, - "headers": { - "content-type": { - "description": "content type header description" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/response-object/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/response-object/root.json deleted file mode 100644 index c41ada395a..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/fixtures/response-object/root.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "responses": { - "default": { - "headers": { - "content-type": { - "$ref": "#/components/headers/content-type" - } - } - } - }, - "headers": { - "content-type": { - "description": "content type header description" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/index.ts deleted file mode 100644 index 7d189882ea..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/header-object/index.ts +++ /dev/null @@ -1,68 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { toValue } from '@swagger-api/apidom-core'; -import { mediaTypes } from '@swagger-api/apidom-ns-openapi-3-1'; - -import { loadJsonFile } from '../../../../helpers'; -import { dereference } from '../../../../../src'; -import * as bootstrap from '../bootstrap'; - -const rootFixturePath = path.join(__dirname, 'fixtures'); - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Header Object', function () { - context('given in components/headers field', function () { - const fixturePath = path.join(rootFixturePath, 'components-headers'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given in Encoding Object', function () { - const fixturePath = path.join(rootFixturePath, 'encoding-object'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given in Response Object', function () { - const fixturePath = path.join(rootFixturePath, 'response-object'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/helpers/parsers/json/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/helpers/parsers/json/index.ts deleted file mode 100644 index 844cce4f68..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/helpers/parsers/json/index.ts +++ /dev/null @@ -1,55 +0,0 @@ -import stampit from 'stampit'; -import { ParseResultElement, from } from '@swagger-api/apidom-core'; -import { mediaTypes } from '@swagger-api/apidom-parser-adapter-json'; - -import { Parser as IParser, File as IFile } from '../../../../../../../src/types'; -import Parser from '../../../../../../../src/parse/parsers/Parser'; -import { ParserError } from '../../../../../../../src'; - -const JsonParser: stampit.Stamp = stampit(Parser, { - props: { - name: 'json-swagger-client', - fileExtensions: ['.json'], - mediaTypes, - }, - methods: { - async canParse(file: IFile): Promise { - const hasSupportedFileExtension = - this.fileExtensions.length === 0 ? true : this.fileExtensions.includes(file.extension); - const hasSupportedMediaType = this.mediaTypes.includes(file.mediaType); - - if (!hasSupportedFileExtension) return false; - if (hasSupportedMediaType) return true; - if (!hasSupportedMediaType) { - try { - JSON.parse(file.toString()); - return true; - } catch { - return false; - } - } - return false; - }, - async parse(file: IFile): Promise { - if (this.sourceMap) { - // eslint-disable-next-line no-console - console.warn("json-swagger-client parser plugin doesn't support sourceMaps option"); - } - - const source = file.toString(); - - try { - const element = from(JSON.parse(source)); - const parseResultElement = new ParseResultElement(); - - element.classes.push('result'); - parseResultElement.push(element); - return parseResultElement; - } catch (error: any) { - throw new ParserError(`Error parsing "${file.uri}"`, error); - } - }, - }, -}); - -export default JsonParser; diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/helpers/parsers/openapi-json-3-1/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/helpers/parsers/openapi-json-3-1/index.ts deleted file mode 100644 index fcaf0cce26..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/helpers/parsers/openapi-json-3-1/index.ts +++ /dev/null @@ -1,61 +0,0 @@ -import stampit from 'stampit'; -import { ParseResultElement } from '@swagger-api/apidom-core'; -import { OpenApi3_1Element } from '@swagger-api/apidom-ns-openapi-3-1'; -import { mediaTypes, detectionRegExp } from '@swagger-api/apidom-parser-adapter-openapi-json-3-1'; - -import { ParserError } from '../../../../../../../src/util/errors'; -import { File as IFile, Parser as IParser } from '../../../../../../../src/types'; -import Parser from '../../../../../../../src/parse/parsers/Parser'; - -// eslint-disable-next-line @typescript-eslint/naming-convention -const OpenApiJson3_1Parser: stampit.Stamp = stampit(Parser, { - props: { - name: 'openapi-json-3-1-swagger-client', - fileExtensions: ['.json'], - mediaTypes, - }, - methods: { - async canParse(file: IFile): Promise { - const hasSupportedFileExtension = - this.fileExtensions.length === 0 ? true : this.fileExtensions.includes(file.extension); - const hasSupportedMediaType = this.mediaTypes.includes(file.mediaType); - - if (!hasSupportedFileExtension) return false; - if (hasSupportedMediaType) return true; - if (!hasSupportedMediaType) { - try { - const source = file.toString(); - JSON.parse(source); - return detectionRegExp.test(source); - } catch { - return false; - } - } - return false; - }, - async parse(file: IFile): Promise { - if (this.sourceMap) { - // eslint-disable-next-line no-console - console.warn( - "openapi-json-3-1-swagger-client parser plugin doesn't support sourceMaps option", - ); - } - - const source = file.toString(); - - try { - const pojo = JSON.parse(source); - const element = OpenApi3_1Element.refract(pojo, this.refractorOpts); - const parseResultElement = new ParseResultElement(); - - element.classes.push('result'); - parseResultElement.push(element); - return parseResultElement; - } catch (error: any) { - throw new ParserError(`Error parsing "${file.uri}"`, error); - } - }, - }, -}); - -export default OpenApiJson3_1Parser; diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/helpers/parsers/openapi-yaml-3-1/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/helpers/parsers/openapi-yaml-3-1/index.ts deleted file mode 100644 index 6670a289c7..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/helpers/parsers/openapi-yaml-3-1/index.ts +++ /dev/null @@ -1,63 +0,0 @@ -import stampit from 'stampit'; -// @ts-ignore -import YAML from 'js-yaml'; // js-yaml comes with swagger-client -import { ParseResultElement } from '@swagger-api/apidom-core'; -import { OpenApi3_1Element } from '@swagger-api/apidom-ns-openapi-3-1'; -import { mediaTypes, detectionRegExp } from '@swagger-api/apidom-parser-adapter-openapi-yaml-3-1'; - -import { ParserError } from '../../../../../../../src/util/errors'; -import { File as IFile, Parser as IParser } from '../../../../../../../src/types'; -import Parser from '../../../../../../../src/parse/parsers/Parser'; - -// eslint-disable-next-line @typescript-eslint/naming-convention -const OpenApiYaml3_1Parser: stampit.Stamp = stampit(Parser, { - props: { - name: 'openapi-yaml-3-1-swagger-client', - fileExtensions: ['.yaml', '.yml'], - mediaTypes, - }, - methods: { - async canParse(file: IFile): Promise { - const hasSupportedFileExtension = - this.fileExtensions.length === 0 ? true : this.fileExtensions.includes(file.extension); - const hasSupportedMediaType = this.mediaTypes.includes(file.mediaType); - - if (!hasSupportedFileExtension) return false; - if (hasSupportedMediaType) return true; - if (!hasSupportedMediaType) { - try { - const source = file.toString(); - YAML.load(source); - return detectionRegExp.test(source); - } catch { - return false; - } - } - return false; - }, - async parse(file: IFile): Promise { - if (this.sourceMap) { - // eslint-disable-next-line no-console - console.warn( - "openapi-yaml-3-1-swagger-client parser plugin doesn't support sourceMaps option", - ); - } - - const source = file.toString(); - - try { - const pojo = YAML.load(source); - const element = OpenApi3_1Element.refract(pojo, this.refractorOpts); - const parseResultElement = new ParseResultElement(); - - element.classes.push('result'); - parseResultElement.push(element); - return parseResultElement; - } catch (error: any) { - throw new ParserError(`Error parsing "${file.uri}"`, error); - } - }, - }, -}); - -export default OpenApiYaml3_1Parser; diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/helpers/parsers/yaml1-2/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/helpers/parsers/yaml1-2/index.ts deleted file mode 100644 index a286a06802..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/helpers/parsers/yaml1-2/index.ts +++ /dev/null @@ -1,57 +0,0 @@ -import stampit from 'stampit'; -// @ts-ignore -import YAML, { JSON_SCHEMA } from 'js-yaml'; // js-yaml comes with swagger-client -import { ParseResultElement, from } from '@swagger-api/apidom-core'; -import { mediaTypes } from '@swagger-api/apidom-parser-adapter-yaml-1-2'; - -import { ParserError } from '../../../../../../../src/util/errors'; -import { File as IFile, Parser as IParser } from '../../../../../../../src/types'; -import Parser from '../../../../../../../src/parse/parsers/Parser'; - -const YamlParser: stampit.Stamp = stampit(Parser, { - props: { - name: 'yaml-1-2-swagger-client', - fileExtensions: ['.yaml', '.yml'], - mediaTypes, - }, - methods: { - async canParse(file: IFile): Promise { - const hasSupportedFileExtension = - this.fileExtensions.length === 0 ? true : this.fileExtensions.includes(file.extension); - const hasSupportedMediaType = this.mediaTypes.includes(file.mediaType); - - if (!hasSupportedFileExtension) return false; - if (hasSupportedMediaType) return true; - if (!hasSupportedMediaType) { - try { - YAML.load(file.toString(), { schema: JSON_SCHEMA }); - return true; - } catch { - return false; - } - } - return false; - }, - async parse(file: IFile): Promise { - if (this.sourceMap) { - // eslint-disable-next-line no-console - console.warn("yaml-1-2-swagger-client parser plugin doesn't support sourceMaps option"); - } - - const source = file.toString(); - - try { - const element = from(YAML.load(source, { schema: JSON_SCHEMA })); - const parseResultElement = new ParseResultElement(); - - element.classes.push('result'); - parseResultElement.push(element); - return parseResultElement; - } catch (error: any) { - throw new ParserError(`Error parsing "${file.uri}"`, error); - } - }, - }, -}); - -export default YamlParser; diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/dereference-apidom.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/dereference-apidom.ts deleted file mode 100644 index e5489cc560..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/dereference-apidom.ts +++ /dev/null @@ -1,74 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { - mediaTypes, - isLinkElement, - LinkElement, - isOperationElement, - OpenApi3_1Element, -} from '@swagger-api/apidom-ns-openapi-3-1'; -import { evaluate } from '@swagger-api/apidom-json-pointer'; - -import { parse, dereferenceApiDOM } from '../../../../../src'; -import * as bootstrap from '../bootstrap'; - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Link Object', function () { - context('given single LinkElement passed to dereferenceApiDOM', function () { - const fixturePath = path.join( - __dirname, - 'fixtures', - 'operation-ref-external', - 'root.json', - ); - - specify('should dereference', async function () { - const parseResult = await parse(fixturePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const linkElement = evaluate( - '/components/links/link1', - parseResult.api as OpenApi3_1Element, - ); - const dereferenced = (await dereferenceApiDOM(linkElement, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { baseURI: fixturePath }, - })) as LinkElement; - - assert.isTrue(isLinkElement(dereferenced)); - assert.isTrue(isOperationElement(dereferenced.operationRef?.meta.get('operation'))); - }); - - specify('should dereference and contain metadata about origin', async function () { - const parseResult = await parse(fixturePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const linkElement = evaluate( - '/components/links/link1', - parseResult.api as OpenApi3_1Element, - ); - const dereferenced = (await dereferenceApiDOM(linkElement, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { baseURI: fixturePath }, - })) as LinkElement; - - assert.match( - dereferenced.operationRef?.meta.get('operation').meta.get('ref-origin').toValue(), - /operation-ref-external\/ex\.json$/, - ); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/components-links/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/components-links/dereferenced.json deleted file mode 100644 index 15e6146695..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/components-links/dereferenced.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "links": { - "link1": { - "operationId": "op1" - }, - "link2": { - "operationId": "op1" - } - }, - "pathItems": { - "pathItem1": { - "get": { - "operationId": "op1" - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/components-links/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/components-links/root.json deleted file mode 100644 index 1503044b06..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/components-links/root.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "links": { - "link1": { - "operationId": "op1" - }, - "link2": { - "$ref": "#/components/links/link1" - } - }, - "pathItems": { - "pathItem1": { - "get": { - "operationId": "op1" - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-id-non-existent/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-id-non-existent/root.json deleted file mode 100644 index 3d24df3526..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-id-non-existent/root.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "links": { - "link1": { - "operationId": "op1" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-id/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-id/dereferenced.json deleted file mode 100644 index 54b33ce516..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-id/dereferenced.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "links": { - "link1": { - "operationId": "op1" - } - }, - "pathItems": { - "pathItem1": { - "get": { - "operationId": "op1", - "description": "description of operation" - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-id/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-id/root.json deleted file mode 100644 index 45a7f2b541..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-id/root.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "links": { - "link1": { - "operationId": "op1" - } - }, - "pathItems": { - "pathItem1": { - "get": { - "operationId": "op1", - "description": "description of operation" - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-external/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-external/dereferenced.json deleted file mode 100644 index c8ccfd0370..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-external/dereferenced.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "links": { - "link1": { - "operationRef": "./ex.json#/operation" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-external/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-external/ex.json deleted file mode 100644 index 3d6eb5ad85..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-external/ex.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "operation": { - "description": "description of operation" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-external/root.json deleted file mode 100644 index 76e6167168..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-external/root.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "links": { - "link1": { - "operationRef": "./ex.json#/operation" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-id-both-defined/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-id-both-defined/root.json deleted file mode 100644 index 78b2af181a..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-id-both-defined/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "links": { - "link1": { - "operationRef": "#/components/pathItems/pathItem1/get", - "operationId": "op1" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-ignore-external/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-ignore-external/dereferenced.json deleted file mode 100644 index c8ccfd0370..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-ignore-external/dereferenced.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "links": { - "link1": { - "operationRef": "./ex.json#/operation" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-ignore-external/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-ignore-external/ex.json deleted file mode 100644 index 3d6eb5ad85..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-ignore-external/ex.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "operation": { - "description": "description of operation" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-ignore-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-ignore-external/root.json deleted file mode 100644 index 76e6167168..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-ignore-external/root.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "links": { - "link1": { - "operationRef": "./ex.json#/operation" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-internal/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-internal/dereferenced.json deleted file mode 100644 index 11d3b1a74f..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-internal/dereferenced.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "links": { - "link1": { - "operationRef": "#/components/pathItems/pathItem1/get" - } - }, - "pathItems": { - "pathItem1": { - "get": { - "description": "description of operation" - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-internal/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-internal/root.json deleted file mode 100644 index e91b65104d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-internal/root.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "links": { - "link1": { - "operationRef": "#/components/pathItems/pathItem1/get" - } - }, - "pathItems": { - "pathItem1": { - "get": { - "description": "description of operation" - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-invalid-pointer/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-invalid-pointer/root.json deleted file mode 100644 index 2da69bb325..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-invalid-pointer/root.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "links": { - "link1": { - "operationRef": "invalid-pointer" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-unresolvable/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-unresolvable/root.json deleted file mode 100644 index 3b24ce87df..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/operation-ref-unresolvable/root.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "links": { - "link1": { - "operationRef": "#/components/invalid-pointer" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/response-object/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/response-object/dereferenced.json deleted file mode 100644 index de73b5e73c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/response-object/dereferenced.json +++ /dev/null @@ -1,29 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "responses": { - "201": { - "description": "201 description", - "links": { - "link": { - "operationId": "op1" - } - } - } - }, - "links": { - "link1": { - "operationId": "op1" - } - }, - "pathItems": { - "pathItem1": { - "get": { - "operationId": "op1" - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/response-object/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/response-object/root.json deleted file mode 100644 index 40cebbda47..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/fixtures/response-object/root.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "responses": { - "201": { - "description": "201 description", - "links": { - "link": { - "$ref": "#/components/links/link1" - } - } - } - }, - "links": { - "link1": { - "operationId": "op1" - } - }, - "pathItems": { - "pathItem1": { - "get": { - "operationId": "op1" - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/index.ts deleted file mode 100644 index e652982c55..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/link-object/index.ts +++ /dev/null @@ -1,270 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { toValue } from '@swagger-api/apidom-core'; -import { isOperationElement, LinkElement, mediaTypes } from '@swagger-api/apidom-ns-openapi-3-1'; -import { evaluate } from '@swagger-api/apidom-json-pointer'; - -import { loadJsonFile } from '../../../../helpers'; -import { dereference } from '../../../../../src'; -import { DereferenceError } from '../../../../../src/util/errors'; -import * as bootstrap from '../bootstrap'; - -const rootFixturePath = path.join(__dirname, 'fixtures'); - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Link Object', function () { - context('given in components/links field', function () { - const fixturePath = path.join(rootFixturePath, 'components-links'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - - specify( - 'should set Operation Object as metadata of Link.operationId field', - async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const link1 = evaluate('/0/components/links/link1', dereferenced) as LinkElement; - const link2 = evaluate('/0/components/links/link2', dereferenced) as LinkElement; - - assert.isTrue(isOperationElement(link1.operationId?.meta.get('operation'))); - assert.isTrue(isOperationElement(link2.operationId?.meta.get('operation'))); - }, - ); - }); - - context('given in Response Object', function () { - const fixturePath = path.join(rootFixturePath, 'response-object'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - - specify( - 'should set Operation Object as metadata of Link.operationId field', - async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const link1 = evaluate( - '/0/components/responses/201/links/link', - dereferenced, - ) as LinkElement; - const link2 = evaluate('/0/components/links/link1', dereferenced) as LinkElement; - - assert.isTrue(isOperationElement(link1.operationId?.meta.get('operation'))); - assert.isTrue(isOperationElement(link2.operationId?.meta.get('operation'))); - }, - ); - }); - - context('given operationRef field', function () { - context('and with internal JSON Pointer', function () { - const fixturePath = path.join(rootFixturePath, 'operation-ref-internal'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - - specify( - 'should set Operation Object as metadata of Link.operationRef field', - async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const link1 = evaluate('/0/components/links/link1', dereferenced) as LinkElement; - - assert.isTrue(isOperationElement(link1.operationRef?.meta.get('operation'))); - }, - ); - }); - - context('and with external JSON Pointer', function () { - const fixturePath = path.join(rootFixturePath, 'operation-ref-external'); - const rootFilePath = path.join(fixturePath, 'root.json'); - - specify('should dereference', async function () { - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - - specify('should apply semantics to external fragment', async function () { - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - - assert.isTrue( - // @ts-ignore - isOperationElement(dereferenced.api.components.links.get('link1').operation), - ); - }); - - specify( - 'should set Operation Object as metadata of Link.operationRef field', - async function () { - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const link1 = evaluate('/0/components/links/link1', dereferenced) as LinkElement; - - assert.isTrue(isOperationElement(link1.operationRef?.meta.get('operation'))); - }, - ); - }); - - context('with external resolution disabled', function () { - const fixturePath = path.join(rootFixturePath, 'operation-ref-ignore-external'); - - specify('should not dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { external: false }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('and with invalid JSON Pointer', function () { - const fixturePath = path.join(rootFixturePath, 'operation-ref-invalid-pointer'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('and with unresolvable JSON Pointer', function () { - const fixturePath = path.join(rootFixturePath, 'operation-ref-unresolvable'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - }); - - context('given operationId field', function () { - context('and OperationElement with operationId exists', function () { - const fixturePath = path.join(rootFixturePath, 'operation-id'); - const rootFilePath = path.join(fixturePath, 'root.json'); - - specify('should dereference', async function () { - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - - specify( - 'should set Operation Object as metadata of Link.operationId field', - async function () { - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const link1 = evaluate('/0/components/links/link1', dereferenced) as LinkElement; - - assert.isTrue(isOperationElement(link1.operationId?.meta.get('operation'))); - }, - ); - }); - - context("and OperationElement with operationId doesn't exist", function () { - const fixturePath = path.join(rootFixturePath, 'operation-id-non-existent'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - }); - - context('given both operationRef and operationId fields are defined', function () { - const fixturePath = path.join(rootFixturePath, 'operation-ref-id-both-defined'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (error: any) { - assert.strictEqual( - error.cause.cause.message, - 'LinkElement operationRef and operationId fields are mutually exclusive.', - ); - assert.instanceOf(error, DereferenceError); - } - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/components-parameters/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/components-parameters/dereferenced.json deleted file mode 100644 index 2c916faa64..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/components-parameters/dereferenced.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "param1": { - "name": "offset", - "in": "query", - "required": true - }, - "param2": { - "name": "offset", - "in": "query", - "required": true - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/components-parameters/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/components-parameters/root.json deleted file mode 100644 index e6601b6f18..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/components-parameters/root.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "param1": { - "name": "offset", - "in": "query", - "required": true - }, - "param2": { - "$ref": "#/components/parameters/param1" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/operation-object/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/operation-object/dereferenced.json deleted file mode 100644 index e9fe33b1bf..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/operation-object/dereferenced.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "openapi": "3.1.0", - "paths": { - "/path": { - "get": { - "parameters": [ - { - "name": "offset", - "in": "query", - "required": true - } - ] - } - } - }, - "components": { - "parameters": { - "param1": { - "name": "offset", - "in": "query", - "required": true - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/operation-object/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/operation-object/root.json deleted file mode 100644 index f17d04e46b..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/operation-object/root.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path": { - "get": { - "parameters": [ - { - "$ref": "#/components/parameters/param1" - } - ] - } - } - }, - "components": { - "parameters": { - "param1": { - "name": "offset", - "in": "query", - "required": true - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/path-item-object/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/path-item-object/dereferenced.json deleted file mode 100644 index 7258f817b0..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/path-item-object/dereferenced.json +++ /dev/null @@ -1,25 +0,0 @@ -[ - { - "openapi": "3.1.0", - "paths": { - "/path": { - "parameters": [ - { - "name": "offset", - "in": "query", - "required": true - } - ] - } - }, - "components": { - "parameters": { - "param1": { - "name": "offset", - "in": "query", - "required": true - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/path-item-object/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/path-item-object/root.json deleted file mode 100644 index 280da6ecde..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/fixtures/path-item-object/root.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path": { - "parameters": [ - { - "$ref": "#/components/parameters/param1" - } - ] - } - }, - "components": { - "parameters": { - "param1": { - "name": "offset", - "in": "query", - "required": true - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/index.ts deleted file mode 100644 index d95478ba73..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/parameter-object/index.ts +++ /dev/null @@ -1,68 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { toValue } from '@swagger-api/apidom-core'; -import { mediaTypes } from '@swagger-api/apidom-ns-openapi-3-1'; - -import { loadJsonFile } from '../../../../helpers'; -import { dereference } from '../../../../../src'; -import * as bootstrap from '../bootstrap'; - -const rootFixturePath = path.join(__dirname, 'fixtures'); - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Parameter Object', function () { - context('given in components/parameters field', function () { - const fixturePath = path.join(rootFixturePath, 'components-parameters'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given in Path Item Object', function () { - const fixturePath = path.join(rootFixturePath, 'path-item-object'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given in Operation Object', function () { - const fixturePath = path.join(rootFixturePath, 'operation-object'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/dereference-apidom.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/dereference-apidom.ts deleted file mode 100644 index bfd198c894..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/dereference-apidom.ts +++ /dev/null @@ -1,63 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { - mediaTypes, - isPathItemElement, - OpenApi3_1Element, -} from '@swagger-api/apidom-ns-openapi-3-1'; -import { evaluate, compile } from '@swagger-api/apidom-json-pointer'; - -import { parse, dereferenceApiDOM } from '../../../../../src'; -import * as bootstrap from '../bootstrap'; - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Path Item Object', function () { - context('given single PathItemElement passed to dereferenceApiDOM', function () { - const fixturePath = path.join(__dirname, 'fixtures', 'external-only', 'root.json'); - - specify('should dereference', async function () { - const parseResult = await parse(fixturePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const pathItemElement = evaluate( - compile(['paths', '/path1']), - parseResult.api as OpenApi3_1Element, - ); - const dereferenced = await dereferenceApiDOM(pathItemElement, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { baseURI: fixturePath }, - }); - - assert.isTrue(isPathItemElement(dereferenced)); - }); - - specify('should dereference and contain metadata about origin', async function () { - const parseResult = await parse(fixturePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const pathItemElement = evaluate( - compile(['paths', '/path1']), - parseResult.api as OpenApi3_1Element, - ); - const dereferenced = await dereferenceApiDOM(pathItemElement, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { baseURI: fixturePath }, - }); - - assert.match(dereferenced.meta.get('ref-origin').toValue(), /external-only\/ex\.json$/); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/additional-fields/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/additional-fields/dereferenced.json deleted file mode 100644 index 3d0e6b4ed1..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/additional-fields/dereferenced.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "openapi": "3.1.0", - "paths": { - "/path1": { - "summary": "path1 item summary", - "description": "path item description", - "get": {} - }, - "/path2": { - "summary": "path2 item summary", - "description": "path item description", - "get": {} - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/additional-fields/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/additional-fields/root.json deleted file mode 100644 index a49cbf0e5f..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/additional-fields/root.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "#/paths/~1path2", - "summary": "path1 item summary" - }, - "/path2": { - "summary": "path2 item summary", - "description": "path item description", - "get": {} - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/callback-object/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/callback-object/dereferenced.json deleted file mode 100644 index 4c753eb15c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/callback-object/dereferenced.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "callbacks": { - "callback1": { - "{$method}": { - "description": "description of callback2" - } - }, - "callback2": { - "{$method}": { - "description": "description of callback2" - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/callback-object/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/callback-object/root.json deleted file mode 100644 index 20b09ffb6b..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/callback-object/root.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "callbacks": { - "callback1": { - "$ref": "#/components/callbacks/callback2" - }, - "callback2": { - "{$method}": { - "description": "description of callback2" - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/components-path-items/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/components-path-items/dereferenced.json deleted file mode 100644 index b254953a38..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/components-path-items/dereferenced.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "pathItems": { - "pathItem1": { - "description": "description of path item 1" - }, - "pathItem2": { - "description": "description of path item 1" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/components-path-items/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/components-path-items/root.json deleted file mode 100644 index 6c51ddca2c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/components-path-items/root.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "pathItems": { - "pathItem1": { - "description": "description of path item 1" - }, - "pathItem2": { - "$ref": "#/components/pathItems/pathItem1" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/direct-external-circular/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/direct-external-circular/ex.json deleted file mode 100644 index 4d55709987..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/direct-external-circular/ex.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "$ref": "./root.json#/paths/~1path1" -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/direct-external-circular/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/direct-external-circular/root.json deleted file mode 100644 index 7850ce66b6..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/direct-external-circular/root.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "./ex.json" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/direct-internal-circular/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/direct-internal-circular/root.json deleted file mode 100644 index c727e272f0..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/direct-internal-circular/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "#/paths/~1path2" - }, - "/path2": { - "$ref": "#/paths/~1path1" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-indirections/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-indirections/dereferenced.json deleted file mode 100644 index 8f02538ef6..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-indirections/dereferenced.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "openapi": "3.1.0", - "paths": { - "/path1": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-indirections/ex1.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-indirections/ex1.json deleted file mode 100644 index d7b3e3be55..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-indirections/ex1.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "$ref": "./ex2.json#/~1path3" -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-indirections/ex2.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-indirections/ex2.json deleted file mode 100644 index e6d9558407..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-indirections/ex2.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/path3": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-indirections/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-indirections/root.json deleted file mode 100644 index 5557004334..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-indirections/root.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "./ex1.json" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-only/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-only/dereferenced.json deleted file mode 100644 index 8f02538ef6..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-only/dereferenced.json +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "openapi": "3.1.0", - "paths": { - "/path1": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-only/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-only/ex.json deleted file mode 100644 index da09224581..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-only/ex.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/path2": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-only/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-only/root.json deleted file mode 100644 index 5843b01245..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/external-only/root.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "./ex.json#/~1path2" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/ignore-external/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/ignore-external/dereferenced.json deleted file mode 100644 index dde8e5a6a8..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/ignore-external/dereferenced.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "./ex.json#/~1path2" - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/ignore-external/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/ignore-external/ex.json deleted file mode 100644 index da09224581..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/ignore-external/ex.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/path2": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/ignore-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/ignore-external/root.json deleted file mode 100644 index 5843b01245..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/ignore-external/root.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "./ex.json#/~1path2" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/indirect-external-circular/ex1.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/indirect-external-circular/ex1.json deleted file mode 100644 index 8e49d4768f..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/indirect-external-circular/ex1.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "$ref": "./ex2.json" -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/indirect-external-circular/ex2.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/indirect-external-circular/ex2.json deleted file mode 100644 index 4d55709987..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/indirect-external-circular/ex2.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "$ref": "./root.json#/paths/~1path1" -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/indirect-external-circular/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/indirect-external-circular/root.json deleted file mode 100644 index 5557004334..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/indirect-external-circular/root.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "./ex1.json" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/indirect-internal-circular/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/indirect-internal-circular/root.json deleted file mode 100644 index 16c0928aa1..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/indirect-internal-circular/root.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "#/paths/~1path2" - }, - "/path2": { - "$ref": "#/paths/~1path3" - }, - "/path3": { - "$ref": "#/paths/~1path1" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-external/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-external/dereferenced.json deleted file mode 100644 index a84c3aa600..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-external/dereferenced.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "openapi": "3.1.0", - "paths": { - "/path1": { - "summary": "path item summary", - "description": "path item description", - "get": {} - }, - "/path3": { - "summary": "path item summary", - "description": "path item description", - "get": {} - }, - "/path4": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-external/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-external/ex.json deleted file mode 100644 index da09224581..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-external/ex.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/path2": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-external/root.json deleted file mode 100644 index 71d688c0be..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-external/root.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "./ex.json#/~1path2" - }, - "/path3": { - "$ref": "#/paths/~1path4" - }, - "/path4": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-indirections/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-indirections/dereferenced.json deleted file mode 100644 index 417a402ed3..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-indirections/dereferenced.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "openapi": "3.1.0", - "paths": { - "/path1": { - "summary": "path item summary", - "description": "path item description", - "get": {} - }, - "/path2": { - "summary": "path item summary", - "description": "path item description", - "get": {} - }, - "/path3": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-indirections/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-indirections/root.json deleted file mode 100644 index bf154cb3e5..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-indirections/root.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "#/paths/~1path2" - }, - "/path2": { - "$ref": "#/paths/~1path3" - }, - "/path3": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-only/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-only/dereferenced.json deleted file mode 100644 index 417a402ed3..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-only/dereferenced.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "openapi": "3.1.0", - "paths": { - "/path1": { - "summary": "path item summary", - "description": "path item description", - "get": {} - }, - "/path2": { - "summary": "path item summary", - "description": "path item description", - "get": {} - }, - "/path3": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-only/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-only/root.json deleted file mode 100644 index bf154cb3e5..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/internal-only/root.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "#/paths/~1path2" - }, - "/path2": { - "$ref": "#/paths/~1path3" - }, - "/path3": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/invalid-pointer/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/invalid-pointer/root.json deleted file mode 100644 index 8d4df81c5d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/invalid-pointer/root.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "invalid-pointer" - }, - "/path2": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/max-depth/ex1.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/max-depth/ex1.json deleted file mode 100644 index d7b3e3be55..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/max-depth/ex1.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "$ref": "./ex2.json#/~1path3" -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/max-depth/ex2.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/max-depth/ex2.json deleted file mode 100644 index e6d9558407..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/max-depth/ex2.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "/path3": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/max-depth/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/max-depth/root.json deleted file mode 100644 index 5557004334..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/max-depth/root.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "./ex1.json" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/dereferenced.json deleted file mode 100644 index 3cfa9cf6f2..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/dereferenced.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "pathItems": { - "externalRef": { - "description": "external ref", - "get": {}, - "$$ref": "http://localhost:8123/ex3.json#/externalPathItem" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/ex1.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/ex1.json deleted file mode 100644 index f46bebc5f4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/ex1.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex2.json#/indirection" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/ex2.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/ex2.json deleted file mode 100644 index 5d5e2e2955..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/ex2.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex3.json#/externalPathItem" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/ex3.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/ex3.json deleted file mode 100644 index 08774eea34..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/ex3.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "externalPathItem": { - "description": "this is path item stored in external file", - "get": {} - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/root.json deleted file mode 100644 index 0601253768..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-external/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "pathItems": { - "externalRef": { - "$ref": "./ex1.json#/indirection", - "description": "external ref" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-internal/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-internal/dereferenced.json deleted file mode 100644 index 3a4375cef0..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-internal/dereferenced.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "pathItems": { - "pathItem1": { - "summary": "path item summary", - "description": "path item description", - "$$ref": "http://localhost:8123/root.json#/components/pathItems/pathItem3" - }, - "pathItem2": { - "summary": "path item summary", - "description": "path item description", - "$$ref": "http://localhost:8123/root.json#/components/pathItems/pathItem3" - }, - "pathItem3": { - "summary": "path item summary", - "description": "path item description" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-internal/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-internal/root.json deleted file mode 100644 index b745848015..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/meta-patches-internal/root.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "pathItems": { - "pathItem1": { - "$ref": "#/components/pathItems/pathItem2" - }, - "pathItem2": { - "$ref": "#/components/pathItems/pathItem3" - }, - "pathItem3": { - "summary": "path item summary", - "description": "path item description" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/unresolvable-path-item/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/unresolvable-path-item/root.json deleted file mode 100644 index 1f7c6dcf9b..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/unresolvable-path-item/root.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path1": { - "$ref": "#/paths/invalid-pointer" - }, - "/path2": { - "summary": "path item summary", - "description": "path item description", - "get": {} - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/webhooks/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/webhooks/dereferenced.json deleted file mode 100644 index bda44d5d11..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/webhooks/dereferenced.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "openapi": "3.1.0", - "webhooks": { - "hook": { - "description": "description of path item 1" - } - }, - "components": { - "pathItems": { - "pathItem1": { - "description": "description of path item 1" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/webhooks/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/webhooks/root.json deleted file mode 100644 index 569afa66cc..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/fixtures/webhooks/root.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "openapi": "3.1.0", - "webhooks": { - "hook": { - "$ref": "#/components/pathItems/pathItem1" - } - }, - "components": { - "pathItems": { - "pathItem1": { - "description": "description of path item 1" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/index.ts deleted file mode 100644 index f2432d0abf..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/path-item-object/index.ts +++ /dev/null @@ -1,345 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { toValue } from '@swagger-api/apidom-core'; -import { mediaTypes } from '@swagger-api/apidom-ns-openapi-3-1'; - -import { createHTTPServer, loadJsonFile } from '../../../../helpers'; -import { dereference } from '../../../../../src'; -import { DereferenceError, MaximumDereferenceDepthError } from '../../../../../src/util/errors'; -import * as bootstrap from '../bootstrap'; -import OpenApi3_1SwaggerClientDereferenceStrategy from '../../../../../src/dereference/strategies/openapi-3-1-swagger-client'; - -const rootFixturePath = path.join(__dirname, 'fixtures'); - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Path Item Object', function () { - context('given in webhooks field', function () { - const fixturePath = path.join(rootFixturePath, 'webhooks'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given in components/pathItems field', function () { - const fixturePath = path.join(rootFixturePath, 'components-path-items'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given in Callback Object', function () { - const fixturePath = path.join(rootFixturePath, 'callback-object'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Path Item Object $ref field', function () { - context('given $ref field pointing internally only', function () { - const fixturePath = path.join(rootFixturePath, 'internal-only'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given $ref field pointing externally only', function () { - const fixturePath = path.join(rootFixturePath, 'external-only'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given $ref field pointing internally and externally', function () { - const fixturePath = path.join(rootFixturePath, 'internal-external'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given $ref field + additional fields', function () { - const fixturePath = path.join(rootFixturePath, 'additional-fields'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given external resolution disabled', function () { - const fixturePath = path.join(rootFixturePath, 'ignore-external'); - - specify('should not dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { external: false }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given $ref field pointing to internal indirection', function () { - const fixturePath = path.join(rootFixturePath, 'internal-indirections'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given $ref field pointing to external indirections', function () { - const fixturePath = path.join(rootFixturePath, 'external-indirections'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given $ref field pointing internally', function () { - context('and allowMetaPatches=true', function () { - specify('should dereference', async function () { - let httpServer: any; - - try { - const fixturePath = path.join(rootFixturePath, 'meta-patches-internal'); - httpServer = createHTTPServer({ port: 8123, cwd: fixturePath }); - const actual = await dereference('http://localhost:8123/root.json', { - parse: { mediaType: mediaTypes.latest('json') }, - dereference: { - strategies: [ - OpenApi3_1SwaggerClientDereferenceStrategy({ allowMetaPatches: true }), - ], - }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - } finally { - httpServer?.terminate(); - } - }); - }); - }); - - context('given $ref field pointing externally', function () { - context('and allowMetaPatches=true', function () { - specify('should dereference', async function () { - let httpServer: any; - - try { - const fixturePath = path.join(rootFixturePath, 'meta-patches-external'); - httpServer = createHTTPServer({ port: 8123, cwd: fixturePath }); - const actual = await dereference('http://localhost:8123/root.json', { - parse: { mediaType: mediaTypes.latest('json') }, - dereference: { - strategies: [ - OpenApi3_1SwaggerClientDereferenceStrategy({ allowMetaPatches: true }), - ], - }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - } finally { - httpServer?.terminate(); - } - }); - }); - }); - - context('given $ref field with invalid JSON Pointer', function () { - const fixturePath = path.join(rootFixturePath, 'invalid-pointer'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given $ref field and maxDepth of dereference', function () { - const fixturePath = path.join(rootFixturePath, 'max-depth'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - dereference: { maxDepth: 1 }, - }); - assert.fail('should throw MaximumDereferenceDepthError'); - } catch (error: any) { - assert.instanceOf(error, DereferenceError); - assert.instanceOf(error.cause.cause, MaximumDereferenceDepthError); - assert.match(error.cause.cause.message, /fixtures\/max-depth\/ex1.json"$/); - } - }); - }); - - context('given $ref field with unresolvable JSON Pointer', function () { - const fixturePath = path.join(rootFixturePath, 'unresolvable-path-item'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given $ref field with with direct circular internal reference', function () { - const fixturePath = path.join(rootFixturePath, 'direct-internal-circular'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given $ref field with with indirect circular internal reference', function () { - const fixturePath = path.join(rootFixturePath, 'indirect-internal-circular'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given $ref field with with direct circular external reference', function () { - const fixturePath = path.join(rootFixturePath, 'direct-external-circular'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given $ref field with with indirect circular external reference', function () { - const fixturePath = path.join(rootFixturePath, 'indirect-external-circular'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/dereference-apidom.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/dereference-apidom.ts deleted file mode 100644 index a54875f9b7..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/dereference-apidom.ts +++ /dev/null @@ -1,168 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { - mediaTypes, - isParameterElement, - OpenApi3_1Element, -} from '@swagger-api/apidom-ns-openapi-3-1'; -import { evaluate } from '@swagger-api/apidom-json-pointer'; - -import { parse, dereferenceApiDOM } from '../../../../../src'; -import { ServerTerminable, createHTTPServer } from '../../../../helpers'; -import * as bootstrap from '../bootstrap'; - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Reference Object', function () { - context('given single ReferenceElement passed to dereferenceApiDOM', function () { - context('given dereferencing using local file system', function () { - const fixturePath = path.join(__dirname, 'fixtures', 'external-only', 'root.json'); - - specify('should dereference', async function () { - const parseResult = await parse(fixturePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const referenceElement = evaluate( - '/components/parameters/externalRef', - parseResult.api as OpenApi3_1Element, - ); - const dereferenced = await dereferenceApiDOM(referenceElement, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { baseURI: fixturePath }, - }); - - assert.isTrue(isParameterElement(dereferenced)); - }); - - specify('should dereference and contain metadata about origin', async function () { - const parseResult = await parse(fixturePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const referenceElement = evaluate( - '/components/parameters/externalRef', - parseResult.api as OpenApi3_1Element, - ); - const dereferenced = await dereferenceApiDOM(referenceElement, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { baseURI: fixturePath }, - }); - - assert.match( - dereferenced.meta.get('ref-origin').toValue(), - /external-only\/ex\.json$/, - ); - }); - }); - - context('given dereferencing using HTTP protocol', function () { - const fixturePath = path.join(__dirname, 'fixtures', 'external-only', 'root.json'); - const httpPort = 8123; - let httpServer: ServerTerminable; - - beforeEach(function () { - const cwd = path.join(__dirname, 'fixtures', 'external-only'); - httpServer = createHTTPServer({ port: httpPort, cwd }); - }); - - afterEach(async function () { - await httpServer.terminate(); - }); - - specify('should dereference', async function () { - const parseResult = await parse(fixturePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const referenceElement = evaluate( - '/components/parameters/externalRef', - parseResult.api as OpenApi3_1Element, - ); - const dereferenced = await dereferenceApiDOM(referenceElement, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { baseURI: `http://localhost:${httpPort}/root.json` }, - }); - - assert.isTrue(isParameterElement(dereferenced)); - }); - - specify('should dereference and contain metadata about origin', async function () { - const parseResult = await parse(fixturePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const referenceElement = evaluate( - '/components/parameters/externalRef', - parseResult.api as OpenApi3_1Element, - ); - const dereferenced = await dereferenceApiDOM(referenceElement, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { baseURI: `http://localhost:${httpPort}/root.json` }, - }); - - assert.match(dereferenced.meta.get('ref-origin').toValue(), /\/ex\.json$/); - }); - }); - - context('given dereferencing using HTTP protocol and absolute URLs', function () { - const fixturePath = path.join( - __dirname, - 'fixtures', - 'external-only-absolute-url', - 'root.json', - ); - const httpPort = 8123; - let httpServer: ServerTerminable; - - beforeEach(function () { - const cwd = path.join(__dirname, 'fixtures', 'external-only-absolute-url'); - httpServer = createHTTPServer({ port: httpPort, cwd }); - }); - - afterEach(async function () { - await httpServer.terminate(); - }); - - specify('should dereference', async function () { - const parseResult = await parse(fixturePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const referenceElement = evaluate( - '/components/parameters/externalRef', - parseResult.api as OpenApi3_1Element, - ); - const dereferenced = await dereferenceApiDOM(referenceElement, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { baseURI: `http://localhost:${httpPort}/root.json` }, - }); - - assert.isTrue(isParameterElement(dereferenced)); - }); - - specify('should dereference and contain metadata about origin', async function () { - const parseResult = await parse(fixturePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const referenceElement = evaluate( - '/components/parameters/externalRef', - parseResult.api as OpenApi3_1Element, - ); - const dereferenced = await dereferenceApiDOM(referenceElement, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { baseURI: `http://localhost:${httpPort}/root.json` }, - }); - - assert.match(dereferenced.meta.get('ref-origin').toValue(), /\/ex\.json$/); - }); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-fields/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-fields/dereferenced.json deleted file mode 100644 index 0ef1ca9975..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-fields/dereferenced.json +++ /dev/null @@ -1,39 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "userId": { - "name": "userId", - "in": "query", - "description": "description 1", - "required": true - }, - "indirection1": { - "name": "userId", - "in": "query", - "description": "indirect description 1", - "required": true - }, - "indirection2": { - "name": "userId", - "in": "query", - "description": "indirect description 1", - "required": true - }, - "userIdRef": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - }, - "externalRef": { - "name": "externalParameter", - "in": "query", - "description": "pulled from external source", - "required": true - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-fields/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-fields/ex.json deleted file mode 100644 index fc8a07edcd..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-fields/ex.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "externalParameter": { - "name": "externalParameter", - "in": "query", - "description": "this is parameter stored in external file", - "required": true - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-fields/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-fields/root.json deleted file mode 100644 index eba4e6f9aa..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-fields/root.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "userId": { - "$ref": "#/components/parameters/indirection1", - "description": "description 1" - }, - "indirection1": { - "$ref": "#/components/parameters/indirection2", - "summary": "indirect summary 1" - }, - "indirection2": { - "$ref": "#/components/parameters/userIdRef", - "description": "indirect description 1", - "summary": "indirect summary 2" - }, - "userIdRef": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - }, - "externalRef": { - "$ref": "./ex.json#/externalParameter", - "description": "pulled from external source" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-ignored-fields/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-ignored-fields/dereferenced.json deleted file mode 100644 index 0ef1ca9975..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-ignored-fields/dereferenced.json +++ /dev/null @@ -1,39 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "userId": { - "name": "userId", - "in": "query", - "description": "description 1", - "required": true - }, - "indirection1": { - "name": "userId", - "in": "query", - "description": "indirect description 1", - "required": true - }, - "indirection2": { - "name": "userId", - "in": "query", - "description": "indirect description 1", - "required": true - }, - "userIdRef": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - }, - "externalRef": { - "name": "externalParameter", - "in": "query", - "description": "pulled from external source", - "required": true - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-ignored-fields/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-ignored-fields/ex.json deleted file mode 100644 index fc8a07edcd..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-ignored-fields/ex.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "externalParameter": { - "name": "externalParameter", - "in": "query", - "description": "this is parameter stored in external file", - "required": true - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-ignored-fields/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-ignored-fields/root.json deleted file mode 100644 index 87f3dcb727..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/additional-ignored-fields/root.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "userId": { - "$ref": "#/components/parameters/indirection1", - "description": "description 1", - "prop1": "value1", - "prop2": "value2" - }, - "indirection1": { - "$ref": "#/components/parameters/indirection2", - "summary": "indirect summary 1", - "prop1": "value1", - "prop2": "value2" - }, - "indirection2": { - "$ref": "#/components/parameters/userIdRef", - "description": "indirect description 1", - "summary": "indirect summary 2", - "prop1": "value1", - "prop2": "value2" - }, - "userIdRef": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - }, - "externalRef": { - "$ref": "./ex.json#/externalParameter", - "description": "pulled from external source", - "prop1": "value1", - "prop2": "value2" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/cycle-internal/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/cycle-internal/root.json deleted file mode 100644 index badb77703d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/cycle-internal/root.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "parent": { - "$ref": "#/components/schemas/User" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/direct-external-circular/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/direct-external-circular/ex.json deleted file mode 100644 index cec551870e..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/direct-external-circular/ex.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "externalParameter": { - "$ref": "./root.json#/components/parameters/userId" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/direct-external-circular/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/direct-external-circular/root.json deleted file mode 100644 index a71015f00b..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/direct-external-circular/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "$ref": "./ex.json#/externalParameter", - "description": "another ref" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/direct-internal-circular/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/direct-internal-circular/root.json deleted file mode 100644 index 020d39aef6..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/direct-internal-circular/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "userId": { - "$ref": "#/components/parameters/userId", - "description": "description 1" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-circular-dependency/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-circular-dependency/dereferenced.json deleted file mode 100644 index c494edf8b3..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-circular-dependency/dereferenced.json +++ /dev/null @@ -1,21 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "param1": { - "name": "param2", - "in": "query" - }, - "param2": { - "name": "param2", - "in": "query" - }, - "param3": { - "name": "ex-param3", - "in": "query" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-circular-dependency/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-circular-dependency/ex.json deleted file mode 100644 index 2ed2b2f3f2..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-circular-dependency/ex.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "param1": { - "$ref": "./root.json#/components/parameters/param2" - }, - "param2": { - "$ref": "./root.json#/components/parameters/param2" - }, - "param3": { - "name": "ex-param3", - "in": "query" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-circular-dependency/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-circular-dependency/root.json deleted file mode 100644 index c95d70defd..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-circular-dependency/root.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "param1": { - "$ref": "./ex.json#/components/parameters/param1" - }, - "param2": { - "name": "param2", - "in": "query" - }, - "param3": { - "$ref": "./ex.json#/components/parameters/param3" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/dereferenced.json deleted file mode 100644 index 2e51b197ae..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/dereferenced.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "name": "externalParameter", - "in": "query", - "description": "external ref", - "required": true - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/ex1.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/ex1.json deleted file mode 100644 index f46bebc5f4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/ex1.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex2.json#/indirection" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/ex2.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/ex2.json deleted file mode 100644 index 091689f702..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/ex2.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex3.json#/externalParameter" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/ex3.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/ex3.json deleted file mode 100644 index fc8a07edcd..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/ex3.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "externalParameter": { - "name": "externalParameter", - "in": "query", - "description": "this is parameter stored in external file", - "required": true - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/root.json deleted file mode 100644 index 3614c32b3c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-indirections/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "$ref": "./ex1.json#/indirection", - "description": "external ref" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only-absolute-url/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only-absolute-url/dereferenced.json deleted file mode 100644 index 2e51b197ae..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only-absolute-url/dereferenced.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "name": "externalParameter", - "in": "query", - "description": "external ref", - "required": true - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only-absolute-url/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only-absolute-url/ex.json deleted file mode 100644 index fc8a07edcd..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only-absolute-url/ex.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "externalParameter": { - "name": "externalParameter", - "in": "query", - "description": "this is parameter stored in external file", - "required": true - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only-absolute-url/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only-absolute-url/root.json deleted file mode 100644 index ccf0893718..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only-absolute-url/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "$ref": "http://localhost:8123/ex.json#/externalParameter", - "description": "external ref" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only/dereferenced.json deleted file mode 100644 index 2e51b197ae..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only/dereferenced.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "name": "externalParameter", - "in": "query", - "description": "external ref", - "required": true - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only/ex.json deleted file mode 100644 index fc8a07edcd..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only/ex.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "externalParameter": { - "name": "externalParameter", - "in": "query", - "description": "this is parameter stored in external file", - "required": true - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only/root.json deleted file mode 100644 index a512c01553..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/external-only/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "$ref": "./ex.json#/externalParameter", - "description": "external ref" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-arbitrary-$refs/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-arbitrary-$refs/dereferenced.json deleted file mode 100644 index 736c0a6798..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-arbitrary-$refs/dereferenced.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "a": { - "$ref": "#/three" - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-arbitrary-$refs/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-arbitrary-$refs/ex.json deleted file mode 100644 index 2e53208cfc..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-arbitrary-$refs/ex.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "one": { - "$ref": "#/two" - }, - "two": { - "a": { - "$ref": "#/three" - } - }, - "three": { - "b": { - "$ref": "#/two" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-arbitrary-$refs/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-arbitrary-$refs/root.json deleted file mode 100644 index d2127a757b..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-arbitrary-$refs/root.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "$ref": "./ex.json#/one" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-external/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-external/dereferenced.json deleted file mode 100644 index 995356d521..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-external/dereferenced.json +++ /dev/null @@ -1,37 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "userId": { - "name": "userId", - "in": "query", - "description": "override", - "required": true - }, - "indirection1": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - }, - "indirection2": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - }, - "userIdRef": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - }, - "externalRef": { - "$ref": "./ex.json#/externalParameter", - "description": "another ref" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-external/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-external/ex.json deleted file mode 100644 index fc8a07edcd..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-external/ex.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "externalParameter": { - "name": "externalParameter", - "in": "query", - "description": "this is parameter stored in external file", - "required": true - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-external/root.json deleted file mode 100644 index 802a6c0b39..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/ignore-external/root.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "userId": { - "$ref": "#/components/parameters/indirection1", - "description": "override" - }, - "indirection1": { - "$ref": "#/components/parameters/indirection2", - "summary": "indirect summary" - }, - "indirection2": { - "$ref": "#/components/parameters/userIdRef", - "summary": "indirect summary" - }, - "userIdRef": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - }, - "externalRef": { - "$ref": "./ex.json#/externalParameter", - "description": "another ref" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-external-circular/ex1.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-external-circular/ex1.json deleted file mode 100644 index f46bebc5f4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-external-circular/ex1.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex2.json#/indirection" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-external-circular/ex2.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-external-circular/ex2.json deleted file mode 100644 index d44c814227..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-external-circular/ex2.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex3.json#/indirection" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-external-circular/ex3.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-external-circular/ex3.json deleted file mode 100644 index 92be82752c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-external-circular/ex3.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./root.json#/components/parameters/externalRef" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-external-circular/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-external-circular/root.json deleted file mode 100644 index 6e1a722371..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-external-circular/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "$ref": "./ex1.json#/indirection", - "description": "another ref" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-internal-circular/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-internal-circular/root.json deleted file mode 100644 index 58cfa384b6..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/indirect-internal-circular/root.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "userId": { - "$ref": "#/components/parameters/indirection1", - "description": "description 1" - }, - "indirection1": { - "$ref": "#/components/parameters/indirection2", - "description": "description 1" - }, - "indirection2": { - "$ref": "#/components/parameters/indirection3", - "description": "description 1" - }, - "indirection3": { - "$ref": "#/components/parameters/userId", - "description": "description 1" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-external/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-external/dereferenced.json deleted file mode 100644 index 4baa2dc952..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-external/dereferenced.json +++ /dev/null @@ -1,39 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "userId": { - "name": "userId", - "in": "query", - "description": "override", - "required": true - }, - "indirection1": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - }, - "indirection2": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - }, - "userIdRef": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - }, - "externalRef": { - "name": "externalParameter", - "in": "query", - "description": "another ref", - "required": true - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-external/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-external/ex.json deleted file mode 100644 index fc8a07edcd..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-external/ex.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "externalParameter": { - "name": "externalParameter", - "in": "query", - "description": "this is parameter stored in external file", - "required": true - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-external/root.json deleted file mode 100644 index 802a6c0b39..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-external/root.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "userId": { - "$ref": "#/components/parameters/indirection1", - "description": "override" - }, - "indirection1": { - "$ref": "#/components/parameters/indirection2", - "summary": "indirect summary" - }, - "indirection2": { - "$ref": "#/components/parameters/userIdRef", - "summary": "indirect summary" - }, - "userIdRef": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - }, - "externalRef": { - "$ref": "./ex.json#/externalParameter", - "description": "another ref" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-only/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-only/dereferenced.json deleted file mode 100644 index b50576d2ca..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-only/dereferenced.json +++ /dev/null @@ -1,33 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "userId": { - "name": "userId", - "in": "query", - "description": "override", - "required": true - }, - "indirection1": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - }, - "indirection2": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - }, - "userIdRef": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-only/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-only/root.json deleted file mode 100644 index 8f824a35ef..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/internal-only/root.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "userId": { - "$ref": "#/components/parameters/indirection1", - "description": "override" - }, - "indirection1": { - "$ref": "#/components/parameters/indirection2", - "summary": "indirect summary" - }, - "indirection2": { - "$ref": "#/components/parameters/userIdRef", - "summary": "indirect summary" - }, - "userIdRef": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/invalid-pointer/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/invalid-pointer/root.json deleted file mode 100644 index afde294f76..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/invalid-pointer/root.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "userId": { - "$ref": "invalid-pointer", - "description": "override" - }, - "userIdRef": { - "name": "userId", - "in": "query", - "description": "ID of the user", - "required": true - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/max-depth/ex1.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/max-depth/ex1.json deleted file mode 100644 index f46bebc5f4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/max-depth/ex1.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex2.json#/indirection" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/max-depth/ex2.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/max-depth/ex2.json deleted file mode 100644 index 091689f702..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/max-depth/ex2.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex3.json#/externalParameter" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/max-depth/ex3.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/max-depth/ex3.json deleted file mode 100644 index fc8a07edcd..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/max-depth/ex3.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "externalParameter": { - "name": "externalParameter", - "in": "query", - "description": "this is parameter stored in external file", - "required": true - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/max-depth/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/max-depth/root.json deleted file mode 100644 index 3614c32b3c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/max-depth/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "$ref": "./ex1.json#/indirection", - "description": "external ref" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/dereferenced.json deleted file mode 100644 index bec19f8a01..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/dereferenced.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "name": "externalParameter", - "in": "query", - "description": "external ref", - "required": true, - "$$ref": "http://localhost:8123/ex3.json#/externalParameter" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/ex1.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/ex1.json deleted file mode 100644 index f46bebc5f4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/ex1.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex2.json#/indirection" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/ex2.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/ex2.json deleted file mode 100644 index 091689f702..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/ex2.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex3.json#/externalParameter" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/ex3.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/ex3.json deleted file mode 100644 index fc8a07edcd..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/ex3.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "externalParameter": { - "name": "externalParameter", - "in": "query", - "description": "this is parameter stored in external file", - "required": true - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/root.json deleted file mode 100644 index 3614c32b3c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-external/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "$ref": "./ex1.json#/indirection", - "description": "external ref" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-internal/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-internal/dereferenced.json deleted file mode 100644 index 9dffe470b0..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-internal/dereferenced.json +++ /dev/null @@ -1,27 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "param1": { - "name": "offset", - "in": "query", - "required": true, - "$$ref": "http://localhost:8123/root.json#/components/parameters/param3" - }, - "param2": { - "name": "offset", - "in": "query", - "required": true, - "$$ref": "http://localhost:8123/root.json#/components/parameters/param3" - }, - "param3": { - "name": "offset", - "in": "query", - "required": true - } - } - } - } - -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-internal/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-internal/root.json deleted file mode 100644 index be9fcab8b0..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/meta-patches-internal/root.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "param1": { - "$ref": "#/components/parameters/param2" - }, - "param2": { - "$ref": "#/components/parameters/param3" - }, - "param3": { - "name": "offset", - "in": "query", - "required": true - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/dereferenced.json deleted file mode 100644 index 2e51b197ae..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/dereferenced.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "name": "externalParameter", - "in": "query", - "description": "external ref", - "required": true - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/ex1.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/ex1.json deleted file mode 100644 index f46bebc5f4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/ex1.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex2.json#/indirection" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/ex2.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/ex2.json deleted file mode 100644 index 091689f702..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/ex2.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex3.json#/externalParameter" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/ex3.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/ex3.json deleted file mode 100644 index fc8a07edcd..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/ex3.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "externalParameter": { - "name": "externalParameter", - "in": "query", - "description": "this is parameter stored in external file", - "required": true - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/root.json deleted file mode 100644 index 3614c32b3c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/path-encoding/path with spaces/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "$ref": "./ex1.json#/indirection", - "description": "external ref" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/dereferenced.json deleted file mode 100644 index 2e51b197ae..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/dereferenced.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "name": "externalParameter", - "in": "query", - "description": "external ref", - "required": true - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/ex1.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/ex1.json deleted file mode 100644 index f46bebc5f4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/ex1.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex2.json#/indirection" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/ex2.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/ex2.json deleted file mode 100644 index 091689f702..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/ex2.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex3.json#/externalParameter" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/ex3.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/ex3.json deleted file mode 100644 index fc8a07edcd..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/ex3.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "externalParameter": { - "name": "externalParameter", - "in": "query", - "description": "this is parameter stored in external file", - "required": true - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/root.json deleted file mode 100644 index 3614c32b3c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/refset-as-option/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "$ref": "./ex1.json#/indirection", - "description": "external ref" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/unresolvable-reference/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/unresolvable-reference/root.json deleted file mode 100644 index 44e42d9fe4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/fixtures/unresolvable-reference/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "parameters": { - "externalRef": { - "$ref": "./ex.json#/externalParameter", - "description": "external ref" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/index.ts deleted file mode 100644 index 491db250af..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/reference-object/index.ts +++ /dev/null @@ -1,469 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { ParseResultElement, toValue } from '@swagger-api/apidom-core'; -import { isParameterElement, mediaTypes } from '@swagger-api/apidom-ns-openapi-3-1'; -import { evaluate } from '@swagger-api/apidom-json-pointer'; - -import { createHTTPServer, loadJsonFile } from '../../../../helpers'; -import { dereference, dereferenceApiDOM, resolve, parse } from '../../../../../src'; -import { - DereferenceError, - MaximumDereferenceDepthError, - MaximumResolverDepthError, -} from '../../../../../src/util/errors'; -import Reference from '../../../../../src/Reference'; -import ReferenceSet from '../../../../../src/ReferenceSet'; -import OpenApi3_1SwaggerClientDereferenceStrategy from '../../../../../src/dereference/strategies/openapi-3-1-swagger-client'; -import * as bootstrap from '../bootstrap'; - -const rootFixturePath = path.join(__dirname, 'fixtures'); - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Reference Object', function () { - context('given Reference Objects pointing internally and externally', function () { - const fixturePath = path.join(rootFixturePath, 'internal-external'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - - specify('should apply semantics to external fragment', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const fragment = evaluate('/0/components/parameters/externalRef', dereferenced); - - assert.isTrue(isParameterElement(fragment)); - }); - - specify( - 'should annotate transcluded element with additional metadata', - async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const fragment = evaluate('/0/components/parameters/userId', dereferenced); - - assert.strictEqual( - fragment.meta.get('ref-fields').get('$ref').toValue(), - '#/components/parameters/indirection1', - ); - assert.strictEqual( - fragment.meta.get('ref-fields').get('description').toValue(), - 'override', - ); - }, - ); - }); - - context('given Reference Objects pointing internally only', function () { - const fixturePath = path.join(rootFixturePath, 'internal-only'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Reference Objects pointing externally only', function () { - const fixturePath = path.join(rootFixturePath, 'external-only'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Reference Objects pointing to external indirections', function () { - const fixturePath = path.join(rootFixturePath, 'external-indirections'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - - specify('should apply semantics to eventual external fragment', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const fragment = evaluate('/0/components/parameters/externalRef', dereferenced); - - assert.isTrue(isParameterElement(fragment)); - }); - }); - - context('given Reference Objects with additional fields', function () { - const fixturePath = path.join(rootFixturePath, 'additional-fields'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Reference Objects with additional ignored fields', function () { - const fixturePath = path.join(rootFixturePath, 'additional-ignored-fields'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Reference Objects pointing internally', function () { - context('and allowMetaPatches=true', function () { - specify('should dereference', async function () { - let httpServer: any; - - try { - const fixturePath = path.join(rootFixturePath, 'meta-patches-internal'); - httpServer = createHTTPServer({ port: 8123, cwd: fixturePath }); - const actual = await dereference('http://localhost:8123/root.json', { - parse: { mediaType: mediaTypes.latest('json') }, - dereference: { - strategies: [ - OpenApi3_1SwaggerClientDereferenceStrategy({ allowMetaPatches: true }), - ], - }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - } finally { - httpServer?.terminate(); - } - }); - }); - }); - - context('given Reference Objects pointing externally', function () { - context('and allowMetaPatches=true', function () { - specify('should dereference', async function () { - let httpServer: any; - - try { - const fixturePath = path.join(rootFixturePath, 'meta-patches-external'); - httpServer = createHTTPServer({ port: 8123, cwd: fixturePath }); - const actual = await dereference('http://localhost:8123/root.json', { - parse: { mediaType: mediaTypes.latest('json') }, - dereference: { - strategies: [ - OpenApi3_1SwaggerClientDereferenceStrategy({ allowMetaPatches: true }), - ], - }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - } finally { - httpServer?.terminate(); - } - }); - }); - }); - - context('given Reference Objects with internal cycles', function () { - const fixturePath = path.join(rootFixturePath, 'cycle-internal'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const parent = evaluate('/0/components/schemas/User/properties/parent', dereferenced); - const cyclicParent = evaluate( - '/0/components/schemas/User/properties/parent/properties/parent', - dereferenced, - ); - - assert.strictEqual(parent, cyclicParent); - }); - }); - - context('given Reference Objects with external resolution disabled', function () { - const fixturePath = path.join(rootFixturePath, 'ignore-external'); - - specify('should not dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { external: false }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Reference Objects with direct circular internal reference', function () { - const fixturePath = path.join(rootFixturePath, 'direct-internal-circular'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given Reference Objects with indirect circular internal reference', function () { - const fixturePath = path.join(rootFixturePath, 'indirect-internal-circular'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given Reference Objects with direct circular external reference', function () { - const fixturePath = path.join(rootFixturePath, 'direct-external-circular'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given Reference Objects with indirect circular external reference', function () { - const fixturePath = path.join(rootFixturePath, 'indirect-external-circular'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given Reference Objects with unresolvable reference', function () { - const fixturePath = path.join(rootFixturePath, 'unresolvable-reference'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given Reference Objects with invalid JSON Pointer', function () { - const fixturePath = path.join(rootFixturePath, 'invalid-pointer'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given Reference Objects with arbitrary circular references', function () { - const fixturePath = path.join(rootFixturePath, 'ignore-arbitrary-$refs'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Reference Objects with external circular dependency', function () { - const fixturePath = path.join(rootFixturePath, 'external-circular-dependency'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Reference Objects and maxDepth of dereference', function () { - const fixturePath = path.join(rootFixturePath, 'max-depth'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - dereference: { maxDepth: 2 }, - }); - assert.fail('should throw MaximumDereferenceDepthError'); - } catch (error: any) { - assert.instanceOf(error, DereferenceError); - assert.instanceOf(error.cause.cause, MaximumDereferenceDepthError); - assert.match(error.cause.cause.message, /fixtures\/max-depth\/ex2.json"$/); - } - }); - }); - - context('given Reference Objects and maxDepth of resolution', function () { - const fixturePath = path.join(rootFixturePath, 'max-depth'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { maxDepth: 2 }, - }); - assert.fail('should throw MaximumResolverDepthError'); - } catch (error: any) { - assert.instanceOf(error, DereferenceError); - assert.instanceOf(error.cause.cause, MaximumResolverDepthError); - assert.match(error.cause.cause.message, /fixtures\/max-depth\/ex2.json"$/); - } - }); - }); - - context('given refSet is provided as an option', function () { - specify('should dereference without external resolution', async function () { - const fixturePath = path.join(__dirname, 'fixtures', 'refset-as-option'); - const uri = path.join(fixturePath, 'root.json'); - const refSet = await resolve(uri, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const actual = await dereference(uri, { dereference: { refSet } }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - - specify('should dereference single ApiDOM fragment', async function () { - const fixturePath = path.join(__dirname, 'fixtures', 'refset-as-option'); - const uri = path.join(fixturePath, 'root.json'); - const parseResult = await parse(uri, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - // @ts-ignore - const referenceElement = parseResult.api?.components.parameters.get('externalRef'); - const refSet = ReferenceSet(); - const rootFileReference = Reference({ uri, value: parseResult }); - const referenceElementReference = Reference({ - uri: `${uri}#/single-reference-object`, - value: new ParseResultElement([referenceElement]), - }); - // referenceElementReference needs to be added as first to create rootRef - refSet.add(referenceElementReference).add(rootFileReference); - - const actual = await dereferenceApiDOM(referenceElement, { - parse: { mediaType: mediaTypes.latest('generic') }, - resolve: { baseURI: uri }, - dereference: { refSet }, - }); - - const expected = { - name: 'externalParameter', - in: 'query', - description: 'external ref', - required: true, - }; - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given path with invalid URL characters - spaces', function () { - const fixturePath = path.join(rootFixturePath, 'path-encoding', 'path with spaces'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/fixtures/components-request-bodies/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/fixtures/components-request-bodies/dereferenced.json deleted file mode 100644 index 6ad8f1d23b..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/fixtures/components-request-bodies/dereferenced.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "requestBodies": { - "requestBody1": { - "description": "example1 description" - }, - "requestBody2": { - "description": "example1 description" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/fixtures/components-request-bodies/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/fixtures/components-request-bodies/root.json deleted file mode 100644 index 5ec8a98824..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/fixtures/components-request-bodies/root.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "requestBodies": { - "requestBody1": { - "description": "example1 description" - }, - "requestBody2": { - "$ref": "#/components/requestBodies/requestBody1" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/fixtures/operation-object/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/fixtures/operation-object/dereferenced.json deleted file mode 100644 index 8c50937f46..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/fixtures/operation-object/dereferenced.json +++ /dev/null @@ -1,21 +0,0 @@ -[ - { - "openapi": "3.1.0", - "paths": { - "/path": { - "get": { - "requestBody": { - "description": "description of request body 2" - } - } - } - }, - "components": { - "requestBodies": { - "requestBody2": { - "description": "description of request body 2" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/fixtures/operation-object/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/fixtures/operation-object/root.json deleted file mode 100644 index 5cb414e333..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/fixtures/operation-object/root.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path": { - "get": { - "requestBody": { - "$ref": "#/components/requestBodies/requestBody2" - } - } - } - }, - "components": { - "requestBodies": { - "requestBody2": { - "description": "description of request body 2" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/index.ts deleted file mode 100644 index 63cff08401..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/request-body-object/index.ts +++ /dev/null @@ -1,54 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { toValue } from '@swagger-api/apidom-core'; -import { mediaTypes } from '@swagger-api/apidom-ns-openapi-3-1'; - -import { loadJsonFile } from '../../../../helpers'; -import { dereference } from '../../../../../src'; -import * as bootstrap from '../bootstrap'; - -const rootFixturePath = path.join(__dirname, 'fixtures'); - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Request Body Object', function () { - context('given in components/requestBodies field', function () { - const fixturePath = path.join(rootFixturePath, 'components-request-bodies'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given in Operation Object', function () { - const fixturePath = path.join(rootFixturePath, 'operation-object'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/fixtures/components-responses/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/fixtures/components-responses/dereferenced.json deleted file mode 100644 index 990f84fd2c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/fixtures/components-responses/dereferenced.json +++ /dev/null @@ -1,31 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "responses": { - "201": { - "description": "201 description", - "headers": { - "Content-Type": { - "description": "The number of allowed requests in the current period", - "schema": { - "type": "integer" - } - } - } - }, - "400": { - "description": "201 description", - "headers": { - "Content-Type": { - "description": "The number of allowed requests in the current period", - "schema": { - "type": "integer" - } - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/fixtures/components-responses/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/fixtures/components-responses/root.json deleted file mode 100644 index 9b8fa923a3..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/fixtures/components-responses/root.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "responses": { - "201": { - "description": "201 description", - "headers": { - "Content-Type": { - "description": "The number of allowed requests in the current period", - "schema": { - "type": "integer" - } - } - } - }, - "400": { - "$ref": "#/components/responses/201" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/fixtures/responses-object/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/fixtures/responses-object/dereferenced.json deleted file mode 100644 index 8100dbd632..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/fixtures/responses-object/dereferenced.json +++ /dev/null @@ -1,29 +0,0 @@ -[ - { - "openapi": "3.1.0", - "paths": { - "/path": { - "get": { - "responses": { - "default": { - "description": "first response object" - }, - "200": { - "description": "second response object" - } - } - } - } - }, - "components": { - "responses": { - "default": { - "description": "first response object" - }, - "200": { - "description": "second response object" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/fixtures/responses-object/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/fixtures/responses-object/root.json deleted file mode 100644 index b16f8bfce3..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/fixtures/responses-object/root.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "openapi": "3.1.0", - "paths": { - "/path": { - "get": { - "responses": { - "default": { - "$ref": "#/components/responses/default" - }, - "200": { - "$ref": "#/components/responses/200" - } - } - } - } - }, - "components": { - "responses": { - "default": { - "description": "first response object" - }, - "200": { - "description": "second response object" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/index.ts deleted file mode 100644 index 151825a8d7..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/response-object/index.ts +++ /dev/null @@ -1,54 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { toValue } from '@swagger-api/apidom-core'; -import { mediaTypes } from '@swagger-api/apidom-ns-openapi-3-1'; - -import { loadJsonFile } from '../../../../helpers'; -import { dereference } from '../../../../../src'; -import * as bootstrap from '../bootstrap'; - -const rootFixturePath = path.join(__dirname, 'fixtures'); - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Response Object', function () { - context('given in components/responses field', function () { - const fixturePath = path.join(rootFixturePath, 'components-responses'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given in Responses Object', function () { - const fixturePath = path.join(rootFixturePath, 'responses-object'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/dereference-apidom.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/dereference-apidom.ts deleted file mode 100644 index 5dc8c804d8..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/dereference-apidom.ts +++ /dev/null @@ -1,59 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { mediaTypes, isSchemaElement, OpenApi3_1Element } from '@swagger-api/apidom-ns-openapi-3-1'; -import { evaluate } from '@swagger-api/apidom-json-pointer'; - -import { parse, dereferenceApiDOM } from '../../../../../src'; -import * as bootstrap from '../bootstrap'; - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Schema Object', function () { - context('given single SchemaElement passed to dereferenceApiDOM', function () { - const fixturePath = path.join(__dirname, 'fixtures', 'external-only', 'root.json'); - - specify('should dereference', async function () { - const parseResult = await parse(fixturePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const schemaElement = evaluate( - '/components/schemas/User/properties/profile', - parseResult.api as OpenApi3_1Element, - ); - const dereferenced = await dereferenceApiDOM(schemaElement, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { baseURI: fixturePath }, - }); - - assert.isTrue(isSchemaElement(dereferenced)); - }); - - specify('should dereference and contain metadata about origin', async function () { - const parseResult = await parse(fixturePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const pathItemElement = evaluate( - '/components/schemas/User/properties/profile', - parseResult.api as OpenApi3_1Element, - ); - const dereferenced = await dereferenceApiDOM(pathItemElement, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { baseURI: fixturePath }, - }); - - assert.match(dereferenced.meta.get('ref-origin').toValue(), /external-only\/ex\.json$/); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-external/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-external/dereferenced.json deleted file mode 100644 index 2fd205625d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-external/dereferenced.json +++ /dev/null @@ -1,31 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$anchor": "user-profile", - "properties": { - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-external/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-external/ex.json deleted file mode 100644 index b32830bdc4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-external/ex.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$defs": { - "UserProfile": { - "$anchor": "user-profile", - "properties": { - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-external/root.json deleted file mode 100644 index 5f55276688..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-external/root.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "./ex.json#user-profile" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-internal/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-internal/dereferenced.json deleted file mode 100644 index 6c8fd1b7b6..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-internal/dereferenced.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$anchor": "user-profile", - "properties": { - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - } - } - }, - "UserProfile": { - "$anchor": "user-profile", - "properties": { - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-internal/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-internal/root.json deleted file mode 100644 index f9a30fb1ca..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-internal/root.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "#user-profile" - } - } - }, - "UserProfile": { - "$anchor": "user-profile", - "properties": { - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-not-found/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-not-found/root.json deleted file mode 100644 index f0f2dce912..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$anchor-not-found/root.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "#user-profile" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-unresolvable/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-unresolvable/root.json deleted file mode 100644 index a8a8381127..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-unresolvable/root.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$id": "./schemas/", - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$id": "./nested/", - "$ref": "./ex.json" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-direct/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-direct/dereferenced.json deleted file mode 100644 index 8ffbd8fe73..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-direct/dereferenced.json +++ /dev/null @@ -1,29 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$id": "./nested/", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-direct/nested/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-direct/nested/ex.json deleted file mode 100644 index b7f7f6299c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-direct/nested/ex.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-direct/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-direct/root.json deleted file mode 100644 index 2c9fd869f7..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-direct/root.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$id": "./nested/", - "$ref": "./ex.json" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-enclosing/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-enclosing/dereferenced.json deleted file mode 100644 index 52f96bfc49..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-enclosing/dereferenced.json +++ /dev/null @@ -1,29 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$id": "./nested/", - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-enclosing/nested/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-enclosing/nested/ex.json deleted file mode 100644 index b7f7f6299c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-enclosing/nested/ex.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-enclosing/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-enclosing/root.json deleted file mode 100644 index 4c3fa339ca..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-enclosing/root.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$id": "./nested/", - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "./ex.json" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-external/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-external/dereferenced.json deleted file mode 100644 index 8ffbd8fe73..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-external/dereferenced.json +++ /dev/null @@ -1,29 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$id": "./nested/", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-external/nested/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-external/nested/ex.json deleted file mode 100644 index d5a6ae02c1..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-external/nested/ex.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$defs": { - "UserProfile": { - "$id": "./nested/", - "$ref": "./ex.json" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-external/nested/nested/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-external/nested/nested/ex.json deleted file mode 100644 index b7f7f6299c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-external/nested/nested/ex.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-external/root.json deleted file mode 100644 index ede427d60e..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$id-uri-external/root.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "./nested/ex.json#/$defs/UserProfile" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-$anchor/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-$anchor/dereferenced.json deleted file mode 100644 index bdca4c2d4b..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-$anchor/dereferenced.json +++ /dev/null @@ -1,34 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$anchor": "avatar", - "type": "string" - } - } - }, - "UserProfile": { - "$id": "https://swagger.io/schemas/user-profile", - "type": "object", - "properties": { - "avatar": { - "$anchor": "avatar", - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-$anchor/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-$anchor/root.json deleted file mode 100644 index ab1df7012d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-$anchor/root.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "https://swagger.io/schemas/user-profile#avatar" - } - } - }, - "UserProfile": { - "$id": "https://swagger.io/schemas/user-profile", - "type": "object", - "properties": { - "avatar": { - "$anchor": "avatar", - "type": "string" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-pointer/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-pointer/dereferenced.json deleted file mode 100644 index e21296c93f..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-pointer/dereferenced.json +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "type": "string" - } - } - }, - "UserProfile": { - "$id": "https://swagger.io/schemas/user-profile", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-pointer/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-pointer/root.json deleted file mode 100644 index 89e31d3af1..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-pointer/root.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "https://swagger.io/schemas/user-profile#/properties/avatar" - } - } - }, - "UserProfile": { - "$id": "https://swagger.io/schemas/user-profile", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-relative-reference/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-relative-reference/dereferenced.json deleted file mode 100644 index 5e1ef488f1..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-relative-reference/dereferenced.json +++ /dev/null @@ -1,35 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "$id": "https://swagger.io/schemas/user", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profileAvatar": { - "$id": "/schemas/user-profile/avatar", - "type": "string" - } - } - }, - "UserProfile": { - "$id": "https://swagger.io/schemas/user-profile", - "type": "object", - "properties": { - "avatar": { - "$id": "/schemas/user-profile/avatar", - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-relative-reference/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-relative-reference/root.json deleted file mode 100644 index 80a5976a86..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-relative-reference/root.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "$id": "https://swagger.io/schemas/user", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profileAvatar": { - "$ref": "/schemas/user-profile/avatar" - } - } - }, - "UserProfile": { - "$id": "https://swagger.io/schemas/user-profile", - "type": "object", - "properties": { - "avatar": { - "$id": "/schemas/user-profile/avatar", - "type": "string" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-resolvable/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-resolvable/dereferenced.json deleted file mode 100644 index d79569c33d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-resolvable/dereferenced.json +++ /dev/null @@ -1,23 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-resolvable/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-resolvable/ex.json deleted file mode 100644 index b7f7f6299c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-resolvable/ex.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-resolvable/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-resolvable/root.json deleted file mode 100644 index 7e6dec92a2..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-resolvable/root.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "./ex.json#/properties/avatar" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-unresolvable/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-unresolvable/root.json deleted file mode 100644 index 37f1a25cc3..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url-unresolvable/root.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "./ex.json" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url/dereferenced.json deleted file mode 100644 index 990e6b83a1..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url/dereferenced.json +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$id": "https://swagger.io/schemas/user-profile", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - }, - "UserProfile": { - "$id": "https://swagger.io/schemas/user-profile", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url/root.json deleted file mode 100644 index 1b6485de39..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-url/root.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "https://swagger.io/schemas/user-profile" - } - } - }, - "UserProfile": { - "$id": "https://swagger.io/schemas/user-profile", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-$anchor/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-$anchor/dereferenced.json deleted file mode 100644 index ded6680a23..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-$anchor/dereferenced.json +++ /dev/null @@ -1,34 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$anchor": "avatar", - "type": "string" - } - } - }, - "UserProfile": { - "$id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f", - "type": "object", - "properties": { - "avatar": { - "$anchor": "avatar", - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-$anchor/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-$anchor/root.json deleted file mode 100644 index c519c4e62d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-$anchor/root.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f#avatar" - } - } - }, - "UserProfile": { - "$id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f", - "type": "object", - "properties": { - "avatar": { - "$anchor": "avatar", - "type": "string" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-pointer/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-pointer/dereferenced.json deleted file mode 100644 index eb6bf72bfe..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-pointer/dereferenced.json +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "type": "string" - } - } - }, - "UserProfile": { - "$id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-pointer/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-pointer/root.json deleted file mode 100644 index c53665d5a4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-pointer/root.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f#/properties/avatar" - } - } - }, - "UserProfile": { - "$id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-unresolvable/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-unresolvable/root.json deleted file mode 100644 index f508f83e24..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn-unresolvable/root.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "urn:uuid:3" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn/dereferenced.json deleted file mode 100644 index 61fb93c201..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn/dereferenced.json +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - }, - "UserProfile": { - "$id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn/root.json deleted file mode 100644 index 2c3a9eabd4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$ref-urn/root.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f" - } - } - }, - "UserProfile": { - "$id": "urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-defined/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-defined/dereferenced.json deleted file mode 100644 index f9bf74b20c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-defined/dereferenced.json +++ /dev/null @@ -1,39 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$schema": "https://spec.openapis.org/oas/3.1/dialect/base", - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$schema": "https://spec.openapis.org/oas/3.1/dialect/base", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - }, - "UserProfile": { - "$schema": "https://spec.openapis.org/oas/3.1/dialect/base", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-defined/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-defined/root.json deleted file mode 100644 index 34af5e8ce4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-defined/root.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$schema": "https://spec.openapis.org/oas/3.1/dialect/base", - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "#/components/schemas/UserProfile" - } - } - }, - "UserProfile": { - "$schema": "https://spec.openapis.org/oas/3.1/dialect/base", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-enclosing/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-enclosing/dereferenced.json deleted file mode 100644 index aaba585ba1..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-enclosing/dereferenced.json +++ /dev/null @@ -1,37 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - }, - "UserProfile": { - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-enclosing/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-enclosing/root.json deleted file mode 100644 index 2d4f976f0a..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-enclosing/root.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "#/components/schemas/UserProfile" - } - } - }, - "UserProfile": { - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-mixed/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-mixed/dereferenced.json deleted file mode 100644 index c422a7ef68..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-mixed/dereferenced.json +++ /dev/null @@ -1,39 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$schema": "https://spec.openapis.org/oas/3.1/dialect/base", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - }, - "UserProfile": { - "$schema": "https://spec.openapis.org/oas/3.1/dialect/base", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-mixed/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-mixed/root.json deleted file mode 100644 index dd3b4c451b..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-mixed/root.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "#/components/schemas/UserProfile" - } - } - }, - "UserProfile": { - "$schema": "https://spec.openapis.org/oas/3.1/dialect/base", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-undefined/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-undefined/dereferenced.json deleted file mode 100644 index 8070ecde7a..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-undefined/dereferenced.json +++ /dev/null @@ -1,36 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - }, - "UserProfile": { - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-undefined/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-undefined/root.json deleted file mode 100644 index 0360dcac66..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-undefined/root.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "#/components/schemas/UserProfile" - } - } - }, - "UserProfile": { - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-unrecognized/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-unrecognized/dereferenced.json deleted file mode 100644 index a721e07f86..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-unrecognized/dereferenced.json +++ /dev/null @@ -1,39 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$schema": "https://www.google.com/", - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$schema": "https://www.google.com/", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - }, - "UserProfile": { - "$schema": "https://www.google.com/", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-unrecognized/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-unrecognized/root.json deleted file mode 100644 index 2eb3753431..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/$schema-unrecognized/root.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$schema": "https://www.google.com/", - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "#/components/schemas/UserProfile" - } - } - }, - "UserProfile": { - "$schema": "https://www.google.com/", - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/boolean-json-schema/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/boolean-json-schema/dereferenced.json deleted file mode 100644 index 848bdd22fc..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/boolean-json-schema/dereferenced.json +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": true - } - }, - "UserProfile": true - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/boolean-json-schema/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/boolean-json-schema/root.json deleted file mode 100644 index 2e4b6a1feb..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/boolean-json-schema/root.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "#/components/schemas/UserProfile" - } - } - }, - "UserProfile": true - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled-http/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled-http/dereferenced.json deleted file mode 100644 index 325bce9102..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled-http/dereferenced.json +++ /dev/null @@ -1,21 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "profile": { - "properties": { - "parent": { - "$ref": "http://localhost:8123/ex.json#/$defs/UserProfile" - } - } - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled-http/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled-http/ex.json deleted file mode 100644 index 3867c3eeb0..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled-http/ex.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$defs": { - "UserProfile": { - "properties": { - "parent": { - "$ref": "#/$defs/UserProfile" - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled-http/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled-http/root.json deleted file mode 100644 index 15ee3edf1c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled-http/root.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "profile": { - "$ref": "./ex.json#/$defs/UserProfile" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled/dereferenced.json deleted file mode 100644 index f11c4f3b9c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled/dereferenced.json +++ /dev/null @@ -1,21 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "profile": { - "properties": { - "parent": { - "$ref": "/home/smartbear/ex.json#/$defs/UserProfile" - } - } - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled/ex.json deleted file mode 100644 index 3867c3eeb0..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled/ex.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$defs": { - "UserProfile": { - "properties": { - "parent": { - "$ref": "#/$defs/UserProfile" - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled/root.json deleted file mode 100644 index 15ee3edf1c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external-disabled/root.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "profile": { - "$ref": "./ex.json#/$defs/UserProfile" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external/ex.json deleted file mode 100644 index 3867c3eeb0..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external/ex.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$defs": { - "UserProfile": { - "properties": { - "parent": { - "$ref": "#/$defs/UserProfile" - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external/root.json deleted file mode 100644 index 15ee3edf1c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-external/root.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "profile": { - "$ref": "./ex.json#/$defs/UserProfile" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-disabled-http/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-disabled-http/dereferenced.json deleted file mode 100644 index 9f25cf0878..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-disabled-http/dereferenced.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "parent": { - "$ref": "http://localhost:8123/root.json#/components/schemas/User" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-disabled-http/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-disabled-http/root.json deleted file mode 100644 index badb77703d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-disabled-http/root.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "parent": { - "$ref": "#/components/schemas/User" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-disabled/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-disabled/dereferenced.json deleted file mode 100644 index 02e2d9e1a5..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-disabled/dereferenced.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "parent": { - "$ref": "/home/smartbear/root.json#/components/schemas/User" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-disabled/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-disabled/root.json deleted file mode 100644 index badb77703d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-disabled/root.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "parent": { - "$ref": "#/components/schemas/User" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-external/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-external/ex.json deleted file mode 100644 index 9251c7a6f9..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-external/ex.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "$defs": { - "UserProfile": { - "properties": { - "user": { - "$ref": "./root.json#/components/schemas/User" - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-external/root.json deleted file mode 100644 index 00f24682e8..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal-external/root.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "x-track": "1", - "properties": { - "profile": { - "$ref": "./ex.json#/$defs/UserProfile" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal/root.json deleted file mode 100644 index badb77703d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/cycle-internal/root.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "parent": { - "$ref": "#/components/schemas/User" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/direct-external-circular/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/direct-external-circular/ex.json deleted file mode 100644 index 33dfbc1e5d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/direct-external-circular/ex.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$defs": { - "User": { - "$ref": "./root.json#/components/schemas/User" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/direct-external-circular/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/direct-external-circular/root.json deleted file mode 100644 index a5138ec7bc..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/direct-external-circular/root.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$ref": "./ex.json#/$defs/User" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/direct-internal-circular/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/direct-internal-circular/root.json deleted file mode 100644 index fedad74def..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/direct-internal-circular/root.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$ref": "#/components/schemas/User" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/dereferenced.json deleted file mode 100644 index b7064c600c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/dereferenced.json +++ /dev/null @@ -1,38 +0,0 @@ -[ - { - "info": { - "title": "Swagger Petstore", - "version": "1.0.0" - }, - "openapi": "3.1.0", - "paths": { - "/pets": { - "get": { - "operationId": "listPets", - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "number" - } - }, - "application/yaml": { - "schema": { - "$anchor": "Pet", - "type": "number" - } - } - } - } - } - } - } - }, - "servers": [ - { - "url": "http://petstore.swagger.io/v1" - } - ] - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/def.yml b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/def.yml deleted file mode 100644 index 3191624521..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/def.yml +++ /dev/null @@ -1,4 +0,0 @@ -components: - schemas: - Pet: - $ref: "./def2.yml#/components/schemas/Pet" diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/def2.yml b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/def2.yml deleted file mode 100644 index aa2244e3cf..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/def2.yml +++ /dev/null @@ -1,4 +0,0 @@ -components: - schemas: - Pet: - type: number diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/def3.yml b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/def3.yml deleted file mode 100644 index 19c9ed597f..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/def3.yml +++ /dev/null @@ -1,4 +0,0 @@ -$defs: - Pet: - $anchor: Pet - type: number diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/pets.yml b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/pets.yml deleted file mode 100644 index bf25452e7a..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/pets.yml +++ /dev/null @@ -1,5 +0,0 @@ -get: - operationId: listPets - responses: - "200": - $ref: "./response.yml" diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/response.yml b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/response.yml deleted file mode 100644 index 35c495a154..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/pets/response.yml +++ /dev/null @@ -1,7 +0,0 @@ -content: - application/json: - schema: - $ref: "./def.yml#/components/schemas/Pet" - application/yaml: - schema: - $ref: "./def3.yml#Pet" diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/root.yml b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/root.yml deleted file mode 100644 index 9b879ef29d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/document-boundaries/root.yml +++ /dev/null @@ -1,10 +0,0 @@ -openapi: "3.1.0" -info: - version: 1.0.0 - title: Swagger Petstore -servers: - - url: http://petstore.swagger.io/v1 -paths: - /pets: - $ref: "./pets/pets.yml" - diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-circular-dependency/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-circular-dependency/dereferenced.json deleted file mode 100644 index a3a4d8956a..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-circular-dependency/dereferenced.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "schema1": { - "type": "object" - }, - "schema2": { - "type": "object" - }, - "schema3": { - "type": "string" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-circular-dependency/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-circular-dependency/ex.json deleted file mode 100644 index 088123c177..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-circular-dependency/ex.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "$defs": { - "schema1": { - "$ref": "./root.json#/components/schemas/schema2" - }, - "schema2": { - "$ref": "./root.json#/components/schemas/schema2" - }, - "schema3": { - "type": "string" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-circular-dependency/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-circular-dependency/root.json deleted file mode 100644 index cb923170f5..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-circular-dependency/root.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "schema1": { - "$ref": "./ex.json#/$defs/schema1" - }, - "schema2": { - "type": "object" - }, - "schema3": { - "$ref": "./ex.json#/$defs/schema3" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/dereferenced.json deleted file mode 100644 index fefdfe26ab..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/dereferenced.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "Indirection": { - "type": "object", - "properties": { - "prop1": { - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/ex1.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/ex1.json deleted file mode 100644 index b36a740b4a..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/ex1.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$defs": { - "Indirection": { - "$ref": "./ex2.json#/$defs/Indirection" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/ex2.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/ex2.json deleted file mode 100644 index fde1576500..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/ex2.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$defs": { - "Indirection": { - "$ref": "./ex3.json" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/ex3.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/ex3.json deleted file mode 100644 index c27dc30383..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/ex3.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "object", - "properties": { - "prop1": { - "type": "string" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/root.json deleted file mode 100644 index c4b862d724..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-indirections/root.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "Indirection": { - "$ref": "./ex1.json#/$defs/Indirection" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-only/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-only/dereferenced.json deleted file mode 100644 index 85fde7c64f..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-only/dereferenced.json +++ /dev/null @@ -1,25 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "profile": { - "type": "object", - "properties": { - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-only/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-only/ex.json deleted file mode 100644 index c115310b05..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-only/ex.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "type": "object", - "$defs": { - "UserProfile": { - "type": "object", - "properties": { - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-only/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-only/root.json deleted file mode 100644 index 15ee3edf1c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/external-only/root.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "profile": { - "$ref": "./ex.json#/$defs/UserProfile" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/ignore-external/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/ignore-external/dereferenced.json deleted file mode 100644 index 45494ad27c..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/ignore-external/dereferenced.json +++ /dev/null @@ -1,33 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "profile": { - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - }, - "UserProfile": { - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - }, - "Order": { - "$ref": "./ex.json" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/ignore-external/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/ignore-external/ex.json deleted file mode 100644 index fc8a07edcd..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/ignore-external/ex.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "externalParameter": { - "name": "externalParameter", - "in": "query", - "description": "this is parameter stored in external file", - "required": true - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/ignore-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/ignore-external/root.json deleted file mode 100644 index b58b884fd6..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/ignore-external/root.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "profile": { - "$ref": "#/components/schemas/UserProfile" - } - } - }, - "UserProfile": { - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - }, - "Order": { - "$ref": "./ex.json" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-external-circular/ex1.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-external-circular/ex1.json deleted file mode 100644 index cb58d6153f..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-external-circular/ex1.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$defs": { - "User": { - "$ref": "./ex2.json#/$defs/User" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-external-circular/ex2.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-external-circular/ex2.json deleted file mode 100644 index 556373d11d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-external-circular/ex2.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$defs": { - "User": { - "$ref": "./ex3.json#/$defs/User" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-external-circular/ex3.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-external-circular/ex3.json deleted file mode 100644 index 33dfbc1e5d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-external-circular/ex3.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$defs": { - "User": { - "$ref": "./root.json#/components/schemas/User" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-external-circular/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-external-circular/root.json deleted file mode 100644 index 041b79aa73..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-external-circular/root.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$ref": "./ex1.json#/$defs/User" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-internal-circular/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-internal-circular/root.json deleted file mode 100644 index 460612050d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-internal-circular/root.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$ref": "#/components/schemas/Indirection1" - }, - "Indirection1": { - "$ref": "#/components/schemas/Indirection2" - }, - "Indirection3": { - "$ref": "#/components/schemas/Indirection3" - }, - "Indirection4": { - "$ref": "#/components/schemas/User" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-internal/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-internal/dereferenced.json deleted file mode 100644 index 7e1ddf05f8..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-internal/dereferenced.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object" - }, - "Indirection1": { - "type": "object" - }, - "Indirection2": { - "type": "object" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-internal/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-internal/root.json deleted file mode 100644 index ed545e988d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/indirect-internal/root.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "$ref": "#/components/schemas/Indirection1" - }, - "Indirection1": { - "$ref": "#/components/schemas/Indirection2" - }, - "Indirection2": { - "type": "object" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/infinite-recursion/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/infinite-recursion/root.json deleted file mode 100644 index 145ae4496d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/infinite-recursion/root.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "$ref": "#/components/schemas/UserProfile" - }, - "UserProfile": { - "type": "object", - "$ref": "#/components/schemas/User" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-external/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-external/dereferenced.json deleted file mode 100644 index 149231aee5..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-external/dereferenced.json +++ /dev/null @@ -1,44 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "profile": { - "type": "object", - "properties": { - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - } - } - }, - "UserProfile": { - "type": "object", - "properties": { - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - }, - "Order": { - "type": "object", - "properties": { - "orderId": { - "type": "number" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-external/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-external/ex.json deleted file mode 100644 index 8386ec5706..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-external/ex.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$defs": { - "Order": { - "type": "object", - "properties": { - "orderId": { - "type": "number" - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-external/root.json deleted file mode 100644 index 24c9fa2471..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-external/root.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "profile": { - "$ref": "#/components/schemas/UserProfile" - } - } - }, - "UserProfile": { - "type": "object", - "properties": { - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - }, - "Order": { - "$ref": "./ex.json#/$defs/Order" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-only/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-only/dereferenced.json deleted file mode 100644 index 8070ecde7a..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-only/dereferenced.json +++ /dev/null @@ -1,36 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - }, - "UserProfile": { - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-only/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-only/root.json deleted file mode 100644 index 0360dcac66..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/internal-only/root.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "login": { - "type": "string" - }, - "password": { - "type": "string" - }, - "profile": { - "$ref": "#/components/schemas/UserProfile" - } - } - }, - "UserProfile": { - "type": "object", - "properties": { - "avatar": { - "type": "string" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/invalid-pointer/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/invalid-pointer/root.json deleted file mode 100644 index 4a8c563523..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/invalid-pointer/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "$ref": "#/components/schemas/invalid-pointer" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/max-depth/ex1.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/max-depth/ex1.json deleted file mode 100644 index 7de8b6d855..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/max-depth/ex1.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "object", - "$defs": { - "Indirection": { - "$ref": "./ex2.json#/$defs/Indirection" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/max-depth/ex2.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/max-depth/ex2.json deleted file mode 100644 index 39ed0289dd..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/max-depth/ex2.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "object", - "$defs": { - "Indirection": { - "$ref": "./ex3.json" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/max-depth/ex3.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/max-depth/ex3.json deleted file mode 100644 index e6307dc1c6..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/max-depth/ex3.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "type": "object" -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/max-depth/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/max-depth/root.json deleted file mode 100644 index c20c6b510d..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/max-depth/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "$ref": "./ex1.json#/$defs/Indirection" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/merging-keywords/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/merging-keywords/dereferenced.json deleted file mode 100644 index d0dd4b205a..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/merging-keywords/dereferenced.json +++ /dev/null @@ -1,44 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "profile": { - "type": "object", - "description": "user profile", - "properties": { - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - } - } - }, - "UserProfile": { - "properties": { - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - }, - "Order": { - "type": "object", - "properties": { - "orderId": { - "type": "number" - } - } - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/merging-keywords/ex.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/merging-keywords/ex.json deleted file mode 100644 index bcdbb69541..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/merging-keywords/ex.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "object", - "properties": { - "orderId": { - "type": "number" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/merging-keywords/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/merging-keywords/root.json deleted file mode 100644 index 63ac9e5bd2..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/merging-keywords/root.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "type": "object", - "properties": { - "profile": { - "type": "object", - "description": "user profile", - "$ref": "#/components/schemas/UserProfile" - } - } - }, - "UserProfile": { - "properties": { - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - } - }, - "Order": { - "type": "object", - "$ref": "./ex.json" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/dereferenced.json deleted file mode 100644 index 4d409494c4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/dereferenced.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "externalRef": { - "description": "external ref", - "type": "object", - "$$ref": "http://localhost:8123/ex3.json#/$defs/externalSchema" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/ex1.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/ex1.json deleted file mode 100644 index f46bebc5f4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/ex1.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex2.json#/indirection" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/ex2.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/ex2.json deleted file mode 100644 index ceeb4f9251..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/ex2.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "indirection": { - "$ref": "./ex3.json#/$defs/externalSchema" - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/ex3.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/ex3.json deleted file mode 100644 index e0e2ec2e5f..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/ex3.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "$defs": { - "externalSchema": { - "description": "this is path item stored in external file", - "type": "object" - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/root.json deleted file mode 100644 index fe6be223aa..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-external/root.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "externalRef": { - "$ref": "./ex1.json#/indirection", - "description": "external ref" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-internal/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-internal/dereferenced.json deleted file mode 100644 index 6f9ffbff9a..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-internal/dereferenced.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "schemas": { - "schema1": { - "type": "object", - "$$ref": "http://localhost:8123/root.json#/components/schemas/schema3" - }, - "schema2": { - "type": "object", - "$$ref": "http://localhost:8123/root.json#/components/schemas/schema3" - }, - "schema3": { - "type": "object" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-internal/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-internal/root.json deleted file mode 100644 index 3b107b785b..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/meta-patches-internal/root.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "schema1": { - "$ref": "#/components/schemas/schema2" - }, - "schema2": { - "$ref": "#/components/schemas/schema3" - }, - "schema3": { - "type": "object" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/unresolvable-reference/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/unresolvable-reference/root.json deleted file mode 100644 index 6269b86390..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/fixtures/unresolvable-reference/root.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "schemas": { - "User": { - "properties": { - "profile": { - "$ref": "#/components/schemas/UserProfile" - } - } - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/index.ts deleted file mode 100644 index 93be904def..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/schema-object/index.ts +++ /dev/null @@ -1,1005 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { toValue } from '@swagger-api/apidom-core'; -import { isSchemaElement, mediaTypes } from '@swagger-api/apidom-ns-openapi-3-1'; -import { evaluate } from '@swagger-api/apidom-json-pointer'; - -import { dereference, resolve } from '../../../../../src'; -import { - DereferenceError, - MaximumDereferenceDepthError, - MaximumResolverDepthError, - ResolverError, -} from '../../../../../src/util/errors'; -import { createHTTPServer, loadJsonFile } from '../../../../helpers'; -import { EvaluationJsonSchema$anchorError } from '../../../../../src/dereference/strategies/openapi-3-1/selectors/$anchor/errors'; -import { EvaluationJsonSchemaUriError } from '../../../../../src/dereference/strategies/openapi-3-1/selectors/uri/errors'; -import * as bootstrap from '../bootstrap'; -import OpenApi3_1SwaggerClientDereferenceStrategy from '../../../../../src/dereference/strategies/openapi-3-1-swagger-client'; - -const rootFixturePath = path.join(__dirname, 'fixtures'); - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Schema Object - $ref keyword from core vocabulary', function () { - context('given Schema Objects pointing internally and externally', function () { - const fixturePath = path.join(rootFixturePath, 'internal-external'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - - specify('should apply semantics to external fragment', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const fragment = evaluate('/0/components/schemas/Order', dereferenced); - - assert.isTrue(isSchemaElement(fragment)); - }); - - specify( - 'should annotate transcluded element with additional metadata', - async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const fragment = evaluate( - '/0/components/schemas/User/properties/profile', - dereferenced, - ); - - assert.strictEqual( - fragment.meta.get('ref-fields').get('$ref').toValue(), - '#/components/schemas/UserProfile', - ); - }, - ); - }); - - context('given Schema Objects pointing internally only', function () { - const fixturePath = path.join(rootFixturePath, 'internal-only'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Schema Objects pointing to internal indirections', function () { - const fixturePath = path.join(rootFixturePath, 'indirect-internal'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Schema Objects with internal cycles', function () { - specify('should dereference', async function () { - const fixturePath = path.join(rootFixturePath, 'cycle-internal'); - const rootFilePath = path.join(fixturePath, 'root.json'); - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const parent = evaluate('/0/components/schemas/User/properties/parent', dereferenced); - const cyclicParent = evaluate( - '/0/components/schemas/User/properties/parent/properties/parent', - dereferenced, - ); - - assert.strictEqual(parent, cyclicParent); - }); - - context('and useCircularStructures=false', function () { - specify('should avoid cycles by skipping transclusion', async function () { - const fixturePath = path.join(rootFixturePath, 'cycle-internal-disabled'); - const rootFilePath = path.join(fixturePath, 'root.json'); - const refSet = await resolve(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - refSet.refs[0].uri = '/home/smartbear/root.json'; - const actual = await dereference('/home/smartbear/root.json', { - parse: { mediaType: mediaTypes.latest('json') }, - dereference: { - refSet, - strategies: [ - OpenApi3_1SwaggerClientDereferenceStrategy({ useCircularStructures: false }), - ], - }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - - context('and using HTTP protocol', function () { - specify('should make JSON Pointer absolute', async function () { - let httpServer: any; - - try { - const fixturePath = path.join(rootFixturePath, 'cycle-external-disabled-http'); - httpServer = createHTTPServer({ port: 8123, cwd: fixturePath }); - const actual = await dereference('http://localhost:8123/root.json', { - parse: { mediaType: mediaTypes.latest('json') }, - dereference: { - strategies: [ - OpenApi3_1SwaggerClientDereferenceStrategy({ - useCircularStructures: false, - }), - ], - }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - } finally { - await httpServer?.terminate(); - } - }); - }); - }); - }); - - context('given Schema Objects with external cycles', function () { - specify('should dereference', async function () { - const fixturePath = path.join(rootFixturePath, 'cycle-external'); - const rootFilePath = path.join(fixturePath, 'root.json'); - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const parent = evaluate( - '/0/components/schemas/User/properties/profile/properties/parent', - dereferenced, - ); - const cyclicParent = evaluate( - '/0/components/schemas/User/properties/profile/properties/parent/properties/parent', - dereferenced, - ); - - assert.strictEqual(parent, cyclicParent); - }); - - context('and useCircularStructures=false', function () { - specify('should avoid cycles by skipping transclusion', async function () { - const fixturePath = path.join(rootFixturePath, 'cycle-external-disabled'); - const rootFilePath = path.join(fixturePath, 'root.json'); - const refSet = await resolve(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - refSet.refs[0].uri = '/home/smartbear/root.json'; - refSet.refs[1].uri = '/home/smartbear/ex.json'; - const actual = await dereference('/home/smartbear/root.json', { - parse: { mediaType: mediaTypes.latest('json') }, - dereference: { - refSet, - strategies: [ - OpenApi3_1SwaggerClientDereferenceStrategy({ useCircularStructures: false }), - ], - }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - }); - - context('given Schema Object pointing internally', function () { - context('and allowMetaPatches=true', function () { - specify('should dereference', async function () { - let httpServer: any; - - try { - const fixturePath = path.join(rootFixturePath, 'meta-patches-internal'); - httpServer = createHTTPServer({ port: 8123, cwd: fixturePath }); - const actual = await dereference('http://localhost:8123/root.json', { - parse: { mediaType: mediaTypes.latest('json') }, - dereference: { - strategies: [ - OpenApi3_1SwaggerClientDereferenceStrategy({ allowMetaPatches: true }), - ], - }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - } finally { - httpServer?.terminate(); - } - }); - }); - }); - - context('given Schema Object pointing externally', function () { - context('and allowMetaPatches=true', function () { - specify('should dereference', async function () { - let httpServer: any; - - try { - const fixturePath = path.join(rootFixturePath, 'meta-patches-external'); - httpServer = createHTTPServer({ port: 8123, cwd: fixturePath }); - const actual = await dereference('http://localhost:8123/root.json', { - parse: { mediaType: mediaTypes.latest('json') }, - dereference: { - strategies: [ - OpenApi3_1SwaggerClientDereferenceStrategy({ allowMetaPatches: true }), - ], - }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - } finally { - httpServer?.terminate(); - } - }); - }); - }); - - context('given Schema Objects with internal and external cycles', function () { - const fixturePath = path.join(rootFixturePath, 'cycle-internal-external'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const user = evaluate( - '/0/components/schemas/User/properties/profile/properties/user', - dereferenced, - ); - const cyclicUserInProfile = evaluate( - '/0/components/schemas/User/properties/profile/properties/user/properties/profile/properties/user', - dereferenced, - ); - - assert.strictEqual(user, cyclicUserInProfile); - }); - }); - - context('given Schema Objects with external circular dependency', function () { - const fixturePath = path.join(rootFixturePath, 'external-circular-dependency'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Schema Objects with external resolution disabled', function () { - const fixturePath = path.join(rootFixturePath, 'ignore-external'); - - specify('should not dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { external: false }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Schema Objects with overlapping keywords', function () { - const fixturePath = path.join(rootFixturePath, 'merging-keywords'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Schema Objects pointing externally only', function () { - const fixturePath = path.join(rootFixturePath, 'external-only'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Schema Objects pointing to external indirections', function () { - const fixturePath = path.join(rootFixturePath, 'external-indirections'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - - specify('should apply semantics to eventual external fragment', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const fragment = evaluate('/0/components/schemas/Indirection', dereferenced); - - assert.isTrue(isSchemaElement(fragment)); - }); - }); - - context('given Schema Objects with $schema keyword defined', function () { - const fixturePath = path.join(rootFixturePath, '$schema-defined'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context( - 'given Schema Objects with $schema keyword defined in enclosing Schema Object', - function () { - let dereferenced: any; - let expected: any; - - beforeEach(async function () { - const fixturePath = path.join(rootFixturePath, '$schema-enclosing'); - const rootFilePath = path.join(fixturePath, 'root.json'); - dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - }); - - specify('should dereference', async function () { - assert.deepEqual(toValue(dereferenced), expected); - }); - - specify('should retain $schema before dereferencing', function () { - const profile = evaluate( - '/0/components/schemas/User/properties/profile', - dereferenced, - ); - - assert.strictEqual( - profile.meta.get('inherited$schema').toValue(), - 'https://spec.openapis.org/oas/3.1/dialect/base', - ); - }); - }, - ); - - context('given Schema Objects with mixed $schema keyword defined', function () { - const fixturePath = path.join(rootFixturePath, '$schema-mixed'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Schema Objects with undefined $schema keyword', function () { - let dereferenced: any; - let expected: any; - - beforeEach(async function () { - const fixturePath = path.join(rootFixturePath, '$schema-undefined'); - const rootFilePath = path.join(fixturePath, 'root.json'); - dereferenced = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - }); - - specify('should dereference', async function () { - assert.deepEqual(toValue(dereferenced), expected); - }); - - specify('should inherit default $schema dialect for User', function () { - const user = evaluate('/0/components/schemas/User', dereferenced); - - assert.strictEqual( - user.meta.get('inherited$schema').toValue(), - 'https://spec.openapis.org/oas/3.1/dialect/base', - ); - }); - - specify('should inherit default $schema dialect for User.login', function () { - const user = evaluate('/0/components/schemas/User/properties/login', dereferenced); - - assert.strictEqual( - user.meta.get('inherited$schema').toValue(), - 'https://spec.openapis.org/oas/3.1/dialect/base', - ); - }); - - specify('should inherit default $schema dialect for UserProfile', function () { - const user = evaluate('/0/components/schemas/UserProfile', dereferenced); - - assert.strictEqual( - user.meta.get('inherited$schema').toValue(), - 'https://spec.openapis.org/oas/3.1/dialect/base', - ); - }); - - specify('should inherit default $schema dialect for UserProfile.login', function () { - const user = evaluate( - '/0/components/schemas/UserProfile/properties/avatar', - dereferenced, - ); - - assert.strictEqual( - user.meta.get('inherited$schema').toValue(), - 'https://spec.openapis.org/oas/3.1/dialect/base', - ); - }); - }); - - context('given Schema Objects with unrecognized $schema keyword defined', function () { - const fixturePath = path.join(rootFixturePath, '$schema-unrecognized'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context( - 'given Schema Objects with $id keyword defined directly in referencing Schema Object', - function () { - const fixturePath = path.join(rootFixturePath, '$id-uri-direct'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }, - ); - - context( - 'given Schema Objects with $id keyword defined in enclosing Schema Object', - function () { - const fixturePath = path.join(rootFixturePath, '$id-uri-enclosing'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }, - ); - - context('given Schema Objects with $id keyword pointing to external files', function () { - const fixturePath = path.join(rootFixturePath, '$id-uri-external'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Schema Objects with unresolvable $id values', function () { - const fixturePath = path.join(rootFixturePath, '$id-unresolvable'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (error: any) { - assert.instanceOf(error, DereferenceError); - assert.instanceOf(error.cause.cause, ResolverError); - assert.match(error.cause.cause.message, /\/schemas\/nested\/ex\.json"$/); - } - }); - }); - - context('given Schema Objects with $ref keyword containing URL', function () { - const fixturePath = path.join(rootFixturePath, '$ref-url'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context( - 'given Schema Objects with $ref keyword containing relative references', - function () { - const fixturePath = path.join(rootFixturePath, '$ref-url-relative-reference'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }, - ); - - context( - 'given Schema Objects with $ref keyword containing URL and JSON Pointer fragment', - function () { - const fixturePath = path.join(rootFixturePath, '$ref-url-pointer'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }, - ); - - context('given Schema Objects with $ref keyword containing URL and $anchor', function () { - const fixturePath = path.join(rootFixturePath, '$ref-url-$anchor'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Schema Objects with $ref keyword containing resolvable URL', function () { - const fixturePath = path.join(rootFixturePath, '$ref-url-resolvable'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Schema Objects with $ref keyword containing unresolvable URL', function () { - const fixturePath = path.join(rootFixturePath, '$ref-url-unresolvable'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (error: any) { - assert.instanceOf(error, DereferenceError); - assert.instanceOf(error.cause.cause, ResolverError); - } - }); - }); - - context( - 'given Schema Objects with $ref keyword containing Uniform Resource Name', - function () { - const fixturePath = path.join(rootFixturePath, '$ref-urn'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }, - ); - - context( - 'given Schema Objects with $ref keyword containing Uniform Resource Name and JSON Pointer fragment', - function () { - const fixturePath = path.join(rootFixturePath, '$ref-urn-pointer'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }, - ); - - context( - 'given Schema Objects with $ref keyword containing Uniform Resource Name and $anchor', - function () { - const fixturePath = path.join(rootFixturePath, '$ref-urn-$anchor'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }, - ); - - context( - 'given Schema Objects with $ref keyword containing unresolvable Uniform Resource Name', - function () { - const fixturePath = path.join(rootFixturePath, '$ref-urn-unresolvable'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (error: any) { - assert.instanceOf(error, DereferenceError); - assert.instanceOf(error.cause.cause, EvaluationJsonSchemaUriError); - } - }); - }, - ); - - context( - 'given Schema Objects with $anchor keyword pointing to internal schema', - function () { - const fixturePath = path.join(rootFixturePath, '$anchor-internal'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }, - ); - - context( - 'given Schema Objects with $anchor keyword pointing to external schema', - function () { - const fixturePath = path.join(rootFixturePath, '$anchor-external'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }, - ); - - context('given Schema Objects with various document boundaries', function () { - const fixturePath = path.join(rootFixturePath, 'document-boundaries'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.yml'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('yaml') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Schema Objects with not found $anchor', function () { - const fixturePath = path.join(rootFixturePath, '$anchor-not-found'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (error: any) { - assert.instanceOf(error, DereferenceError); - assert.instanceOf(error.cause.cause, EvaluationJsonSchema$anchorError); - } - }); - }); - - context('given Boolean JSON Schemas', function () { - const fixturePath = path.join(rootFixturePath, 'boolean-json-schema'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - - context('given Schema Objects and maxDepth of dereference', function () { - const fixturePath = path.join(rootFixturePath, 'max-depth'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - dereference: { maxDepth: 2 }, - }); - assert.fail('should throw MaximumDereferenceDepthError'); - } catch (error: any) { - assert.instanceOf(error, DereferenceError); - assert.instanceOf(error.cause.cause, MaximumDereferenceDepthError); - assert.match(error.cause.cause.message, /fixtures\/max-depth\/ex2.json"$/); - } - }); - }); - - context('given Schema Objects and maxDepth of resolution', function () { - const fixturePath = path.join(rootFixturePath, 'max-depth'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - resolve: { maxDepth: 2 }, - }); - assert.fail('should throw MaximumResolverDepthError'); - } catch (error: any) { - assert.instanceOf(error, DereferenceError); - assert.instanceOf(error.cause.cause, MaximumResolverDepthError); - assert.match(error.cause.cause.message, /fixtures\/max-depth\/ex2.json"$/); - } - }); - }); - - context('given Schema Objects with unresolvable reference', function () { - const fixturePath = path.join(rootFixturePath, 'unresolvable-reference'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given Schema Objects with invalid JSON Pointer', function () { - const fixturePath = path.join(rootFixturePath, 'invalid-pointer'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given Schema Objects with infinite recursion', function () { - const fixturePath = path.join(rootFixturePath, 'infinite-recursion'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given Schema Objects with direct circular external reference', function () { - const fixturePath = path.join(rootFixturePath, 'direct-external-circular'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given Schema Objects with direct circular internal reference', function () { - const fixturePath = path.join(rootFixturePath, 'direct-internal-circular'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - - context('given Schema Objects with indirect circular external reference', function () { - const fixturePath = path.join(rootFixturePath, 'indirect-external-circular'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - - context('and useCircularStructures=false', function () { - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - dereference: { - strategies: [ - OpenApi3_1SwaggerClientDereferenceStrategy({ useCircularStructures: false }), - ], - }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - }); - - context('given Schema Objects with indirect circular internal reference', function () { - const fixturePath = path.join(rootFixturePath, 'indirect-internal-circular'); - - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - - context('and useCircularStructures=false', function () { - specify('should throw error', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - try { - await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - dereference: { - strategies: [ - OpenApi3_1SwaggerClientDereferenceStrategy({ useCircularStructures: false }), - ], - }, - }); - assert.fail('should throw DereferenceError'); - } catch (e) { - assert.instanceOf(e, DereferenceError); - } - }); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/security-schemes-object/fixtures/components-security-schemes/dereferenced.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/security-schemes-object/fixtures/components-security-schemes/dereferenced.json deleted file mode 100644 index 26efe25eb3..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/security-schemes-object/fixtures/components-security-schemes/dereferenced.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - { - "openapi": "3.1.0", - "components": { - "securitySchemes": { - "api_key": { - "type": "apiKey", - "name": "api_key", - "in": "header" - }, - "api_key2": { - "type": "apiKey", - "name": "api_key", - "in": "header" - } - } - } - } -] diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/security-schemes-object/fixtures/components-security-schemes/root.json b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/security-schemes-object/fixtures/components-security-schemes/root.json deleted file mode 100644 index 4addc45cac..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/security-schemes-object/fixtures/components-security-schemes/root.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "openapi": "3.1.0", - "components": { - "securitySchemes": { - "api_key": { - "type": "apiKey", - "name": "api_key", - "in": "header" - }, - "api_key2": { - "$ref": "#/components/securitySchemes/api_key" - } - } - } -} diff --git a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/security-schemes-object/index.ts b/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/security-schemes-object/index.ts deleted file mode 100644 index 2fee6cfbe4..0000000000 --- a/packages/apidom-reference/test/dereference/strategies/openapi-3-1-swagger-client/security-schemes-object/index.ts +++ /dev/null @@ -1,40 +0,0 @@ -import path from 'node:path'; -import { assert } from 'chai'; -import { toValue } from '@swagger-api/apidom-core'; -import { mediaTypes } from '@swagger-api/apidom-ns-openapi-3-1'; - -import { loadJsonFile } from '../../../../helpers'; -import { dereference } from '../../../../../src'; -import * as bootstrap from '../bootstrap'; - -const rootFixturePath = path.join(__dirname, 'fixtures'); - -describe('dereference', function () { - before(function () { - bootstrap.before(); - }); - - after(function () { - bootstrap.after(); - }); - - context('strategies', function () { - context('openapi-3-1-swagger-client', function () { - context('Security Scheme Object', function () { - context('given in components/securitySchemes field', function () { - const fixturePath = path.join(rootFixturePath, 'components-security-schemes'); - - specify('should dereference', async function () { - const rootFilePath = path.join(fixturePath, 'root.json'); - const actual = await dereference(rootFilePath, { - parse: { mediaType: mediaTypes.latest('json') }, - }); - const expected = loadJsonFile(path.join(fixturePath, 'dereferenced.json')); - - assert.deepEqual(toValue(actual), expected); - }); - }); - }); - }); - }); -}); diff --git a/packages/apidom-reference/test/resolve/resolvers/http-swagger-client/index.ts b/packages/apidom-reference/test/resolve/resolvers/http-swagger-client/index.ts deleted file mode 100644 index a4fb26c010..0000000000 --- a/packages/apidom-reference/test/resolve/resolvers/http-swagger-client/index.ts +++ /dev/null @@ -1,186 +0,0 @@ -import { Buffer } from 'node:buffer'; -import http from 'node:http'; -import path from 'node:path'; -import { assert } from 'chai'; -import sinon from 'sinon'; -import { identity } from 'ramda'; -// @ts-ignore -import SwaggerClient from 'swagger-client'; - -import HttpResolverSwaggerClient from '../../../../src/resolve/resolvers/http-swagger-client'; -import { ResolverError } from '../../../../src/util/errors'; -import File from '../../../../src/util/File'; -import { createHTTPServer } from '../../../helpers'; - -describe('resolve', function () { - context('resolvers', function () { - context('HttpResolverSwaggerClient', function () { - let resolver: any; - - beforeEach(function () { - resolver = HttpResolverSwaggerClient({ swaggerHTTPClient: SwaggerClient.http }); - }); - - context('canRead', function () { - context('given valid http URL', function () { - specify('should consider it a HTTP URL', function () { - assert.isTrue(resolver.canRead(File({ uri: 'http://swagger.io/file.txt' }))); - }); - }); - - context('given valid https URL', function () { - specify('should consider it a https URL', function () { - assert.isTrue(resolver.canRead(File({ uri: 'https://swagger.io/file.txt' }))); - }); - }); - - context('given URIs with no protocol', function () { - specify('should not consider it a http/https URL', function () { - assert.isFalse(resolver.canRead(File({ uri: '/home/user/file.txt' }))); - assert.isFalse(resolver.canRead(File({ uri: 'C:\\home\\user\\file.txt' }))); - }); - }); - - context('given URLs with other known protocols', function () { - specify('should not consider it a http/https URL', function () { - assert.isFalse(resolver.canRead(File({ uri: 'ftp://swagger.io/' }))); - }); - }); - }); - - context('read', function () { - context('given HTTP URL', function () { - specify('should fetch the URL', async function () { - const url = 'https://httpbin.org/anything'; - const response = new Response(Buffer.from('data')); - const fetchStub = sinon.stub(globalThis, 'fetch'); - - fetchStub.returns(Promise.resolve(response)); - const content = await resolver.read(File({ uri: url })); - - assert.instanceOf(content, ArrayBuffer); - assert.strictEqual(Buffer.from(content).toString(), 'data'); - - fetchStub.restore(); - }); - - specify('should throw on unexpected status codes', async function () { - const url = 'https://httpbin.org/anything'; - const response = new Response(Buffer.from('data'), { - status: 400, - }); - const fetchStub = sinon.stub(globalThis, 'fetch'); - - try { - fetchStub.returns(Promise.resolve(response)); - await resolver.read(File({ uri: url })); - assert.fail('should throw ResolverError'); - } catch (e) { - assert.instanceOf(e, ResolverError); - assert.propertyVal(e, 'message', 'Error downloading "https://httpbin.org/anything"'); - } finally { - fetchStub.restore(); - } - }); - - specify('should throw on timeout', async function () { - resolver = HttpResolverSwaggerClient({ - swaggerHTTPClient: SwaggerClient.http, - timeout: 1, - }); - const url = 'http://localhost:8123/local-file.txt'; - const cwd = path.join(__dirname, 'fixtures'); - const server = createHTTPServer({ port: 8123, cwd }); - - try { - await resolver.read(File({ uri: url })); - assert.fail('should throw ResolverError'); - } catch (error: any) { - assert.strictEqual(error.cause.message, 'The user aborted a request.'); - assert.instanceOf(error, ResolverError); - assert.propertyVal( - error, - 'message', - 'Error downloading "http://localhost:8123/local-file.txt"', - ); - } finally { - await server.terminate(); - } - }); - - context('given withCredentials option', function () { - specify('should allow cross-site Access-Control requests', async function () { - resolver = HttpResolverSwaggerClient({ - swaggerHTTPClient: SwaggerClient.http, - withCredentials: true, - }); - const url = 'https://httpbin.org/anything'; - const response = new Response(Buffer.from('data')); - const fetchStub = sinon.stub(globalThis, 'fetch'); - - try { - fetchStub.returns(Promise.resolve(response)); - await resolver.read(File({ uri: url })); - assert.strictEqual(fetchStub.firstCall.args[1]?.credentials, 'include'); - } finally { - fetchStub.restore(); - } - }); - }); - - context('given global withCredentials override', function () { - specify('should allow cross-site Access-Control requests', async function () { - const url = 'https://httpbin.org/anything'; - const response = new Response(Buffer.from('data')); - const fetchStub = sinon.stub(globalThis, 'fetch'); - const { withCredentials: originalWithCredentials } = SwaggerClient.http; - - SwaggerClient.http.withCredentials = true; - - try { - fetchStub.returns(Promise.resolve(response)); - await resolver.read(File({ uri: url })); - assert.strictEqual(fetchStub.firstCall.args[1]?.credentials, 'include'); - } finally { - fetchStub.restore(); - SwaggerClient.http.withCredentials = originalWithCredentials; - } - }); - }); - - context('given redirects options', function () { - specify('should throw on exceeding redirects', function (done) { - resolver = HttpResolverSwaggerClient({ - swaggerHTTPClient: SwaggerClient.http, - redirects: 0, - }); - const url = 'http://localhost:4444/'; - const server = http.createServer((req, res) => { - res.setHeader('Location', '/foo'); - res.statusCode = 302; - res.end(); - }); - - server.listen(4444, () => { - resolver - .read(File({ uri: url })) - .catch((error: any) => { - assert.instanceOf(error, ResolverError); - assert.strictEqual( - error.cause.message, - 'maximum redirect reached at: http://localhost:4444/foo', - ); - }) - .catch(identity) - .then((error: any) => { - server.close(); - done(error); - }); - }); - }); - }); - }); - }); - }); - }); -});