Skip to content

Commit cba033e

Browse files
authored
Merge pull request #1202 from shockey/master
v3.4.1
2 parents 8c21ccf + ebbb27b commit cba033e

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "swagger-client",
3-
"version": "3.4.0",
3+
"version": "3.4.1",
44
"description": "SwaggerJS - a collection of interfaces for OAI specs",
55
"main": "dist/index.js",
66
"repository": "git@github.com:swagger-api/swagger-js.git",

src/specmap/index.js

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ class SpecMap {
8383
// We might consider making this (traversing & application) configurable later.
8484
function createKeyBasedPlugin(pluginObj) {
8585
return function* (patches, specmap) {
86-
const resultCache = {}
87-
8886
for (const patch of patches.filter(lib.isAdditiveMutation)) {
8987
yield* traverse(patch.value, patch.path, patch)
9088
}
@@ -104,29 +102,13 @@ class SpecMap {
104102
for (const key of Object.keys(obj)) {
105103
const val = obj[key]
106104
const updatedPath = path.concat(key)
107-
const isObj = lib.isObject(val)
108-
109-
// If the object has a meta '$$ref' - and store this $$ref
110-
// in a lookaside to prevent future traversals of this $ref's tree.
111-
const objRef = obj.$$ref
112105

113-
if (isObj) {
114-
// console.log('recursive case', {obj, path, patch})
106+
if (lib.isObject(val)) {
115107
yield* traverse(val, updatedPath, patch)
116108
}
117109

118110
if (!isRootProperties && key === pluginObj.key) {
119-
// console.log('base case', {obj, path, patch})
120-
const stringifiedPath = path.join('/')
121-
122-
if (resultCache[stringifiedPath]) {
123-
yield resultCache[stringifiedPath]
124-
}
125-
else {
126-
const res = pluginObj.plugin(val, key, updatedPath, specmap, patch)
127-
resultCache[stringifiedPath] = res
128-
yield res
129-
}
111+
yield pluginObj.plugin(val, key, updatedPath, specmap, patch)
130112
}
131113
}
132114
}

test/resolver.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ describe('resolver', () => {
294294
}
295295
}
296296

297-
describe.only('Swagger usage', function () {
297+
describe('Swagger usage', function () {
298298
it.skip('should be able to resolve a Swagger document with $refs', () => {
299299
// When
300300
return Swagger.resolve({spec: DOCUMENT_ORIGINAL, allowMetaPatches: false})

0 commit comments

Comments
 (0)