Skip to content

Commit

Permalink
perf(lib/util/resolve-local-ref): optimize split param (#764)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Oct 21, 2023
1 parent 4744e73 commit 2dc46ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/util/resolve-local-ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ function resolveLocalRef (jsonSchema, externalSchemas) {

// $ref is in the format: #/definitions/<resolved definition>/<optional fragment>
if (jsonSchema.$ref) {
const localRef = jsonSchema.$ref.split('/')[2]
const localRef = jsonSchema.$ref.split('/', 3)[2]
if (externalSchemas[localRef]) return resolveLocalRef(externalSchemas[localRef], externalSchemas)
// $ref is in the format: #/components/schemas/<resolved definition>
return resolveLocalRef(externalSchemas[jsonSchema.$ref.split('/')[3]], externalSchemas)
return resolveLocalRef(externalSchemas[jsonSchema.$ref.split('/', 4)[3]], externalSchemas)
}
return jsonSchema
}
Expand Down

0 comments on commit 2dc46ff

Please sign in to comment.