Skip to content

Commit

Permalink
perf(lib): replace accumulator spread with object.assign (#852)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Jan 8, 2025
1 parent d54763d commit 1ea275f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/util/resolve-local-ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ function resolveLocalRef (jsonSchema, externalSchemas) {
// for oneOf, anyOf, allOf support in querystring/params/headers
if (jsonSchema.oneOf || jsonSchema.anyOf || jsonSchema.allOf) {
const schemas = jsonSchema.oneOf || jsonSchema.anyOf || jsonSchema.allOf
return schemas.reduce(function (acc, schema) {
const json = resolveLocalRef(schema, externalSchemas)
return { ...acc, ...json }
}, {})
return schemas.reduce((acc, schema) => Object.assign(acc, resolveLocalRef(schema, externalSchemas)), {})
}

// $ref is in the format: #/definitions/<resolved definition>/<optional fragment>
Expand Down

0 comments on commit 1ea275f

Please # to comment.