Skip to content

Commit

Permalink
fix: don't mutate original schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
AshotN committed Apr 24, 2024
1 parent 657ab29 commit 6cf3699
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 6cf3699

Please sign in to comment.