diff --git a/package-lock.json b/package-lock.json index 51597c511..5eee98878 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,10 +10,10 @@ "license": "Apache-2.0", "dependencies": { "@babel/runtime-corejs3": "^7.20.13", - "@swagger-api/apidom-core": ">=0.70.0 <1.0.0", - "@swagger-api/apidom-json-pointer": ">=0.70.0 <1.0.0", - "@swagger-api/apidom-ns-openapi-3-1": ">=0.70.0 <1.0.0", - "@swagger-api/apidom-reference": ">=0.70.0 <1.0.0", + "@swagger-api/apidom-core": ">=0.70.1 <1.0.0", + "@swagger-api/apidom-json-pointer": ">=0.70.1 <1.0.0", + "@swagger-api/apidom-ns-openapi-3-1": ">=0.70.2 <1.0.0", + "@swagger-api/apidom-reference": ">=0.70.2 <1.0.0", "cookie": "~0.5.0", "cross-fetch": "^3.1.5", "deepmerge": "~4.3.0", @@ -3695,9 +3695,9 @@ } }, "node_modules/@swagger-api/apidom-ns-openapi-3-0": { - "version": "0.70.1", - "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-0/-/apidom-ns-openapi-3-0-0.70.1.tgz", - "integrity": "sha512-lWIZas1dGeqjo3q0Ap7NQwHPDvcYyv9GLX13/u41NmRJP/YIxDG3zhpFgT+ybSBgNvitX53hHZoq71WgGznG5Q==", + "version": "0.70.2", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-0/-/apidom-ns-openapi-3-0-0.70.2.tgz", + "integrity": "sha512-l5HzhVLYNLLZG5wWrrk+yjx6IPLNMNLdzsDCf7kAbHNjzFjQOae8a1j+uV0WB8zANhIPH15CLMP4oAnoBk8y+w==", "dependencies": { "@babel/runtime-corejs3": "^7.20.7", "@swagger-api/apidom-core": "^0.70.1", @@ -3709,13 +3709,13 @@ } }, "node_modules/@swagger-api/apidom-ns-openapi-3-1": { - "version": "0.70.1", - "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-1/-/apidom-ns-openapi-3-1-0.70.1.tgz", - "integrity": "sha512-Qj6d1aiMN8VZ6J/c4TTzFWk1peORtqlo7xzrwKP5mPqaTptCaRibsjFFr0o2CrkureUw9WzDYavQos28ce5vgA==", + "version": "0.70.2", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-1/-/apidom-ns-openapi-3-1-0.70.2.tgz", + "integrity": "sha512-7KSltiGhN6mETElzygVU7lZSpc0Sa08p4bfje7kO75Q7FedWLxIc2P9QOTp3ILNMOksvUtnN91GaH7ZnNJEJ3Q==", "dependencies": { "@babel/runtime-corejs3": "^7.20.7", "@swagger-api/apidom-core": "^0.70.1", - "@swagger-api/apidom-ns-openapi-3-0": "^0.70.1", + "@swagger-api/apidom-ns-openapi-3-0": "^0.70.2", "@types/ramda": "~0.29.1", "ramda": "~0.29.0", "ramda-adjunct": "^4.0.0", @@ -3793,9 +3793,9 @@ "optional": true }, "node_modules/@swagger-api/apidom-reference": { - "version": "0.70.1", - "resolved": "https://registry.npmjs.org/@swagger-api/apidom-reference/-/apidom-reference-0.70.1.tgz", - "integrity": "sha512-gTu+d0KnaWwRT3/RRKn4nPI+3P0WgM9gBNt7mv6HCxJ0iLm/eVIMjwMlmk+jCHPbcNWEg7eilAkQBo21V4cu6Q==", + "version": "0.70.2", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-reference/-/apidom-reference-0.70.2.tgz", + "integrity": "sha512-Qi4RrZEcN2FuoD9Kibw6DjqZ9yS/NlirhSNY+k9sQpn3nqDeAWX2qLuzMWOy+o5IQEa0H/9lNgMWermcbVyN4g==", "dependencies": { "@babel/runtime-corejs3": "^7.20.7", "@swagger-api/apidom-core": "^0.70.1", @@ -3810,17 +3810,17 @@ "optionalDependencies": { "@swagger-api/apidom-json-pointer": "^0.70.1", "@swagger-api/apidom-ns-asyncapi-2": "^0.70.1", - "@swagger-api/apidom-ns-openapi-3-0": "^0.70.1", - "@swagger-api/apidom-ns-openapi-3-1": "^0.70.1", - "@swagger-api/apidom-parser-adapter-api-design-systems-json": "^0.70.1", - "@swagger-api/apidom-parser-adapter-api-design-systems-yaml": "^0.70.1", + "@swagger-api/apidom-ns-openapi-3-0": "^0.70.2", + "@swagger-api/apidom-ns-openapi-3-1": "^0.70.2", + "@swagger-api/apidom-parser-adapter-api-design-systems-json": "^0.70.2", + "@swagger-api/apidom-parser-adapter-api-design-systems-yaml": "^0.70.2", "@swagger-api/apidom-parser-adapter-asyncapi-json-2": "^0.70.1", "@swagger-api/apidom-parser-adapter-asyncapi-yaml-2": "^0.70.1", "@swagger-api/apidom-parser-adapter-json": "^0.70.1", - "@swagger-api/apidom-parser-adapter-openapi-json-3-0": "^0.70.1", - "@swagger-api/apidom-parser-adapter-openapi-json-3-1": "^0.70.1", - "@swagger-api/apidom-parser-adapter-openapi-yaml-3-0": "^0.70.1", - "@swagger-api/apidom-parser-adapter-openapi-yaml-3-1": "^0.70.1", + "@swagger-api/apidom-parser-adapter-openapi-json-3-0": "^0.70.2", + "@swagger-api/apidom-parser-adapter-openapi-json-3-1": "^0.70.2", + "@swagger-api/apidom-parser-adapter-openapi-yaml-3-0": "^0.70.2", + "@swagger-api/apidom-parser-adapter-openapi-yaml-3-1": "^0.70.2", "@swagger-api/apidom-parser-adapter-yaml-1-2": "^0.70.1" } }, @@ -17814,9 +17814,9 @@ } }, "@swagger-api/apidom-ns-openapi-3-0": { - "version": "0.70.1", - "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-0/-/apidom-ns-openapi-3-0-0.70.1.tgz", - "integrity": "sha512-lWIZas1dGeqjo3q0Ap7NQwHPDvcYyv9GLX13/u41NmRJP/YIxDG3zhpFgT+ybSBgNvitX53hHZoq71WgGznG5Q==", + "version": "0.70.2", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-0/-/apidom-ns-openapi-3-0-0.70.2.tgz", + "integrity": "sha512-l5HzhVLYNLLZG5wWrrk+yjx6IPLNMNLdzsDCf7kAbHNjzFjQOae8a1j+uV0WB8zANhIPH15CLMP4oAnoBk8y+w==", "requires": { "@babel/runtime-corejs3": "^7.20.7", "@swagger-api/apidom-core": "^0.70.1", @@ -17828,13 +17828,13 @@ } }, "@swagger-api/apidom-ns-openapi-3-1": { - "version": "0.70.1", - "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-1/-/apidom-ns-openapi-3-1-0.70.1.tgz", - "integrity": "sha512-Qj6d1aiMN8VZ6J/c4TTzFWk1peORtqlo7xzrwKP5mPqaTptCaRibsjFFr0o2CrkureUw9WzDYavQos28ce5vgA==", + "version": "0.70.2", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-ns-openapi-3-1/-/apidom-ns-openapi-3-1-0.70.2.tgz", + "integrity": "sha512-7KSltiGhN6mETElzygVU7lZSpc0Sa08p4bfje7kO75Q7FedWLxIc2P9QOTp3ILNMOksvUtnN91GaH7ZnNJEJ3Q==", "requires": { "@babel/runtime-corejs3": "^7.20.7", "@swagger-api/apidom-core": "^0.70.1", - "@swagger-api/apidom-ns-openapi-3-0": "^0.70.1", + "@swagger-api/apidom-ns-openapi-3-0": "^0.70.2", "@types/ramda": "~0.29.1", "ramda": "~0.29.0", "ramda-adjunct": "^4.0.0", @@ -17902,16 +17902,16 @@ "optional": true }, "@swagger-api/apidom-reference": { - "version": "0.70.1", - "resolved": "https://registry.npmjs.org/@swagger-api/apidom-reference/-/apidom-reference-0.70.1.tgz", - "integrity": "sha512-gTu+d0KnaWwRT3/RRKn4nPI+3P0WgM9gBNt7mv6HCxJ0iLm/eVIMjwMlmk+jCHPbcNWEg7eilAkQBo21V4cu6Q==", + "version": "0.70.2", + "resolved": "https://registry.npmjs.org/@swagger-api/apidom-reference/-/apidom-reference-0.70.2.tgz", + "integrity": "sha512-Qi4RrZEcN2FuoD9Kibw6DjqZ9yS/NlirhSNY+k9sQpn3nqDeAWX2qLuzMWOy+o5IQEa0H/9lNgMWermcbVyN4g==", "requires": { "@babel/runtime-corejs3": "^7.20.7", "@swagger-api/apidom-core": "^0.70.1", "@swagger-api/apidom-json-pointer": "^0.70.1", "@swagger-api/apidom-ns-asyncapi-2": "npm:-@0.0.1", - "@swagger-api/apidom-ns-openapi-3-0": "^0.70.1", - "@swagger-api/apidom-ns-openapi-3-1": "^0.70.1", + "@swagger-api/apidom-ns-openapi-3-0": "^0.70.2", + "@swagger-api/apidom-ns-openapi-3-1": "^0.70.2", "@swagger-api/apidom-parser-adapter-api-design-systems-json": "npm:-@0.0.1", "@swagger-api/apidom-parser-adapter-api-design-systems-yaml": "npm:-@0.0.1", "@swagger-api/apidom-parser-adapter-asyncapi-json-2": "npm:-@0.0.1", diff --git a/package.json b/package.json index 7584d4aaa..b4d7efe0b 100644 --- a/package.json +++ b/package.json @@ -114,10 +114,10 @@ }, "dependencies": { "@babel/runtime-corejs3": "^7.20.13", - "@swagger-api/apidom-core": ">=0.70.0 <1.0.0", - "@swagger-api/apidom-json-pointer": ">=0.70.0 <1.0.0", - "@swagger-api/apidom-ns-openapi-3-1": ">=0.70.0 <1.0.0", - "@swagger-api/apidom-reference": ">=0.70.0 <1.0.0", + "@swagger-api/apidom-core": ">=0.70.1 <1.0.0", + "@swagger-api/apidom-json-pointer": ">=0.70.1 <1.0.0", + "@swagger-api/apidom-ns-openapi-3-1": ">=0.70.2 <1.0.0", + "@swagger-api/apidom-reference": ">=0.70.2 <1.0.0", "cookie": "~0.5.0", "cross-fetch": "^3.1.5", "deepmerge": "~4.3.0", diff --git a/src/resolver/strategies/openapi-3-1-apidom/normalize.js b/src/resolver/strategies/openapi-3-1-apidom/normalize.js index 7caa613b9..4d5806273 100644 --- a/src/resolver/strategies/openapi-3-1-apidom/normalize.js +++ b/src/resolver/strategies/openapi-3-1-apidom/normalize.js @@ -47,12 +47,17 @@ const normalize = (element) => { */ export const pojoAdapter = (normalizeFn) => (spec) => { if (spec?.$$normalized) return spec; + if (pojoAdapter.cache.has(spec)) return spec; const openApiElement = OpenApi3_1Element.refract(spec); const normalized = normalizeFn(openApiElement); + const value = toValue(normalized); - return toValue(normalized); + pojoAdapter.cache.set(spec, value); + + return value; }; +pojoAdapter.cache = new WeakMap(); export default normalize; /* eslint-enable camelcase */