Skip to content
Merged

v3.4.1 #1202

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swagger-client",
"version": "3.4.0",
"version": "3.4.1",
"description": "SwaggerJS - a collection of interfaces for OAI specs",
"main": "dist/index.js",
"repository": "git@github.com:swagger-api/swagger-js.git",
Expand Down
22 changes: 2 additions & 20 deletions src/specmap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ class SpecMap {
// We might consider making this (traversing & application) configurable later.
function createKeyBasedPlugin(pluginObj) {
return function* (patches, specmap) {
const resultCache = {}

for (const patch of patches.filter(lib.isAdditiveMutation)) {
yield* traverse(patch.value, patch.path, patch)
}
Expand All @@ -104,29 +102,13 @@ class SpecMap {
for (const key of Object.keys(obj)) {
const val = obj[key]
const updatedPath = path.concat(key)
const isObj = lib.isObject(val)

// If the object has a meta '$$ref' - and store this $$ref
// in a lookaside to prevent future traversals of this $ref's tree.
const objRef = obj.$$ref

if (isObj) {
// console.log('recursive case', {obj, path, patch})
if (lib.isObject(val)) {
yield* traverse(val, updatedPath, patch)
}

if (!isRootProperties && key === pluginObj.key) {
// console.log('base case', {obj, path, patch})
const stringifiedPath = path.join('/')

if (resultCache[stringifiedPath]) {
yield resultCache[stringifiedPath]
}
else {
const res = pluginObj.plugin(val, key, updatedPath, specmap, patch)
resultCache[stringifiedPath] = res
yield res
}
yield pluginObj.plugin(val, key, updatedPath, specmap, patch)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ describe('resolver', () => {
}
}

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