swagger-client 3.19.8 → 3.19.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,9 +30,13 @@ const normalize = element => {
30
30
  */
31
31
  export const pojoAdapter = normalizeFn => spec => {
32
32
  if (spec?.$$normalized) return spec;
33
+ if (pojoAdapter.cache.has(spec)) return spec;
33
34
  const openApiElement = OpenApi3_1Element.refract(spec);
34
35
  const normalized = normalizeFn(openApiElement);
35
- return toValue(normalized);
36
+ const value = toValue(normalized);
37
+ pojoAdapter.cache.set(spec, value);
38
+ return value;
36
39
  };
40
+ pojoAdapter.cache = new WeakMap();
37
41
  export default normalize;
38
42
  /* eslint-enable camelcase */
@@ -29,14 +29,24 @@ const resolveOpenAPI31Strategy = async options => {
29
29
  mode = 'non-strict'
30
30
  } = options;
31
31
  try {
32
+ const {
33
+ cache
34
+ } = resolveOpenAPI31Strategy;
35
+
32
36
  // determining BaseURI
33
37
  const cwd = url.isHttpUrl(url.cwd()) ? url.cwd() : 'https://smartbear.com/';
34
38
  const retrievalURI = optionsUtil.retrievalURI(options);
35
39
  const baseURI = url.resolve(cwd, retrievalURI);
36
40
 
37
41
  // prepare spec for dereferencing
38
- const openApiElement = OpenApi3_1Element.refract(spec);
39
- openApiElement.classes.push('result');
42
+ let openApiElement;
43
+ if (cache.has(spec)) {
44
+ openApiElement = cache.get(spec);
45
+ } else {
46
+ openApiElement = OpenApi3_1Element.refract(spec);
47
+ openApiElement.classes.push('result');
48
+ cache.set(spec, openApiElement);
49
+ }
40
50
  const openApiParseResultElement = new ParseResultElement([openApiElement]);
41
51
 
42
52
  // prepare fragment for dereferencing
@@ -129,5 +139,6 @@ const resolveOpenAPI31Strategy = async options => {
129
139
  throw error;
130
140
  }
131
141
  };
142
+ resolveOpenAPI31Strategy.cache = new WeakMap();
132
143
  export default resolveOpenAPI31Strategy;
133
144
  /* eslint-enable camelcase */
@@ -201,7 +201,6 @@ class SpecMap {
201
201
  }
202
202
  if (lib.isMutation(patch)) {
203
203
  this.updateMutations(patch);
204
- return;
205
204
  }
206
205
  } catch (e) {
207
206
  console.error(e); // eslint-disable-line no-console
@@ -36,11 +36,15 @@ const normalize = element => {
36
36
  */
37
37
  const pojoAdapter = normalizeFn => spec => {
38
38
  if (spec !== null && spec !== void 0 && spec.$$normalized) return spec;
39
+ if (pojoAdapter.cache.has(spec)) return spec;
39
40
  const openApiElement = _apidomNsOpenapi.OpenApi3_1Element.refract(spec);
40
41
  const normalized = normalizeFn(openApiElement);
41
- return (0, _apidomCore.toValue)(normalized);
42
+ const value = (0, _apidomCore.toValue)(normalized);
43
+ pojoAdapter.cache.set(spec, value);
44
+ return value;
42
45
  };
43
46
  exports.pojoAdapter = pojoAdapter;
47
+ pojoAdapter.cache = new WeakMap();
44
48
  var _default = normalize;
45
49
  /* eslint-enable camelcase */
46
50
  exports.default = _default;
@@ -37,14 +37,24 @@ const resolveOpenAPI31Strategy = async options => {
37
37
  mode = 'non-strict'
38
38
  } = options;
39
39
  try {
40
+ const {
41
+ cache
42
+ } = resolveOpenAPI31Strategy;
43
+
40
44
  // determining BaseURI
41
45
  const cwd = _empty.url.isHttpUrl(_empty.url.cwd()) ? _empty.url.cwd() : 'https://smartbear.com/';
42
46
  const retrievalURI = optionsUtil.retrievalURI(options);
43
47
  const baseURI = _empty.url.resolve(cwd, retrievalURI);
44
48
 
45
49
  // prepare spec for dereferencing
46
- const openApiElement = _apidomNsOpenapi.OpenApi3_1Element.refract(spec);
47
- openApiElement.classes.push('result');
50
+ let openApiElement;
51
+ if (cache.has(spec)) {
52
+ openApiElement = cache.get(spec);
53
+ } else {
54
+ openApiElement = _apidomNsOpenapi.OpenApi3_1Element.refract(spec);
55
+ openApiElement.classes.push('result');
56
+ cache.set(spec, openApiElement);
57
+ }
48
58
  const openApiParseResultElement = new _apidomCore.ParseResultElement([openApiElement]);
49
59
 
50
60
  // prepare fragment for dereferencing
@@ -137,6 +147,7 @@ const resolveOpenAPI31Strategy = async options => {
137
147
  throw error;
138
148
  }
139
149
  };
150
+ resolveOpenAPI31Strategy.cache = new WeakMap();
140
151
  var _default = resolveOpenAPI31Strategy;
141
152
  /* eslint-enable camelcase */
142
153
  exports.default = _default;
@@ -206,7 +206,6 @@ class SpecMap {
206
206
  }
207
207
  if (_index.default.isMutation(patch)) {
208
208
  this.updateMutations(patch);
209
- return;
210
209
  }
211
210
  } catch (e) {
212
211
  console.error(e); // eslint-disable-line no-console
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swagger-client",
3
- "version": "3.19.8",
3
+ "version": "3.19.10",
4
4
  "description": "SwaggerJS - a collection of interfaces for OAI specs",
5
5
  "browser": {
6
6
  "./src/http/fold-formdata-to-request.node.js": "./src/http/fold-formdata-to-request.browser.js",
@@ -82,14 +82,14 @@
82
82
  "babel-loader": "=9.1.2",
83
83
  "babel-plugin-lodash": "=3.3.4",
84
84
  "cross-env": "=7.0.3",
85
- "eslint": "^8.21.0",
85
+ "eslint": "^8.42.0",
86
86
  "eslint-config-airbnb-base": "^15.0.0",
87
87
  "eslint-config-prettier": "=8.8.0",
88
88
  "eslint-plugin-import": "=2.27.5",
89
89
  "eslint-plugin-prettier": "=4.2.1",
90
90
  "expect": "^29.0.3",
91
91
  "fetch-mock": "=9.11.0",
92
- "glob": "=10.2.6",
92
+ "glob": "=10.2.7",
93
93
  "husky": "^8.0.1",
94
94
  "inspectpack": "=4.7.1",
95
95
  "install": "=0.13.0",
@@ -106,18 +106,18 @@
106
106
  "rimraf": "=5.0.1",
107
107
  "source-map-explorer": "^2.5.3",
108
108
  "terser-webpack-plugin": "^5.0.3",
109
- "webpack": "=5.83.1",
109
+ "webpack": "=5.87.0",
110
110
  "webpack-bundle-size-analyzer": "=3.1.0",
111
- "webpack-cli": "=5.1.1",
112
- "webpack-stats-plugin": "=1.1.1",
111
+ "webpack-cli": "=5.1.4",
112
+ "webpack-stats-plugin": "=1.1.3",
113
113
  "xmock": "=0.3.0"
114
114
  },
115
115
  "dependencies": {
116
116
  "@babel/runtime-corejs3": "^7.20.13",
117
- "@swagger-api/apidom-core": ">=0.70.0 <1.0.0",
118
- "@swagger-api/apidom-json-pointer": ">=0.70.0 <1.0.0",
119
- "@swagger-api/apidom-ns-openapi-3-1": ">=0.70.0 <1.0.0",
120
- "@swagger-api/apidom-reference": ">=0.70.0 <1.0.0",
117
+ "@swagger-api/apidom-core": ">=0.70.1 <1.0.0",
118
+ "@swagger-api/apidom-json-pointer": ">=0.70.1 <1.0.0",
119
+ "@swagger-api/apidom-ns-openapi-3-1": ">=0.70.2 <1.0.0",
120
+ "@swagger-api/apidom-reference": ">=0.70.2 <1.0.0",
121
121
  "cookie": "~0.5.0",
122
122
  "cross-fetch": "^3.1.5",
123
123
  "deepmerge": "~4.3.0",