Skip to content

Commit 9d7751c

Browse files
committed
fix: don't mutate original schemas
1 parent 657ab29 commit 9d7751c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/utils.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { assignWithSet } = require('./helpers');
2-
const { omit, pick } = require('lodash');
2+
const { omit, pick, cloneDeep} = require('lodash');
33

44
exports.tag = function tag (name, options = {}) {
55
const result = {
@@ -165,9 +165,10 @@ function determineSchemaPrefix (schemas) {
165165
return undefined;
166166
}
167167

168-
exports.createSwaggerServiceOptions = function createSwaggerServiceOptions ({ schemas, docs, transformSchema }) {
168+
exports.createSwaggerServiceOptions = function createSwaggerServiceOptions ({ schemas: originalSchemas, docs, transformSchema }) {
169169
const serviceDocs = { schemas: {}, refs: {} };
170170
const transformSchemaFn = transformSchema || exports.defaultTransformSchema;
171+
const schemas = cloneDeep(originalSchemas)
171172

172173
let unspecificSchemas;
173174
const prefix = determineSchemaPrefix(schemas);

0 commit comments

Comments
 (0)