diff --git a/lib/utils.js b/lib/utils.js index a8625cb..766f7c1 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -1,5 +1,5 @@ const { assignWithSet } = require('./helpers'); -const { omit, pick } = require('lodash'); +const { omit, pick, cloneDeep} = require('lodash'); exports.tag = function tag (name, options = {}) { const result = { @@ -165,9 +165,10 @@ function determineSchemaPrefix (schemas) { return undefined; } -exports.createSwaggerServiceOptions = function createSwaggerServiceOptions ({ schemas, docs, transformSchema }) { +exports.createSwaggerServiceOptions = function createSwaggerServiceOptions ({ schemas:originalSchemas, docs, transformSchema }) { const serviceDocs = { schemas: {}, refs: {} }; const transformSchemaFn = transformSchema || exports.defaultTransformSchema; + const schemas = cloneDeep(originalSchemas) let unspecificSchemas; const prefix = determineSchemaPrefix(schemas);