Skip to content

Commit

Permalink
replace regex with endswith
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewuu committed Sep 11, 2024
1 parent b85c0d3 commit fae8967
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/lib/blueprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,7 @@ const getNamespace = (path: string, paths: OpenapiPaths): string | null => {

// An endpoint is a route that ends without further paths. i.e., ends in
// a letter (not slash).
const endpoints = pathKeys.filter((key) =>
new RegExp(`^/${[...namespace, part].join('/')}/\\w+$`).test(key),
)
const endpoints = pathKeys.filter((key) => !key.endsWith('/'))

if (endpoints.length === 0) {
namespace.push(part)
Expand Down

0 comments on commit fae8967

Please sign in to comment.