Skip to content

Commit

Permalink
Change regex to support multiple params when including file path para…
Browse files Browse the repository at this point in the history
…ms (#1)

* Change regex to support multiple params when including URI path param
* Update regex, remove unnecessary bracket
  • Loading branch information
guillerecalde authored and Mitchell3514 committed Jan 31, 2024
1 parent 327646e commit 9fb9a3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/framework/openapi.spec.loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class OpenApiSpecLoader {
// instead create our own syntax that is compatible with express' pathToRegex
// /{path}* => /:path*)
// /{path}(*) => /:path*)
const pass1 = part.replace(/\/{([^\*]+)}\({0,1}(\*)\){0,1}/g, '/:$1$2');
const pass1 = part.replace(/\/{([^}]+)}\({0,1}(\*)\){0,1}/g, '/:$1$2');
// substitute params with express equivalent
// /path/{id} => /path/:id
return pass1.replace(/\{([^}]+)}/g, ':$1');
Expand Down

0 comments on commit 9fb9a3a

Please sign in to comment.