From 894f9e9611c5c72e18027af63e0abdeeb6c5701a Mon Sep 17 00:00:00 2001 From: Carmine DiMascio Date: Wed, 13 Nov 2019 21:20:28 -0500 Subject: [PATCH] upgrade path-to-regex v4 --- package-lock.json | 6 +++--- package.json | 2 +- src/framework/base.path.ts | 4 ++-- src/middlewares/openapi.metadata.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4b5bbf97..4bccf535 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4068,9 +4068,9 @@ "dev": true }, "path-to-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-4.0.0.tgz", - "integrity": "sha512-WePdN1ndXgSWXXWrmKJxLSlazaMPeW8UYVQ63NDBHikr61eNUGCJrCEemfaQLSxGHzqzcu1YSlZu7CqqWh2Lfw==" + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-4.0.5.tgz", + "integrity": "sha512-l+fTaGG2N9ZRpCEUj5fG1VKdDLaiqwCIvPngpnxzREhcdobhZC4ou4w984HBu72DqAJ5CfcdV6tjqNOunfpdsQ==" }, "path-type": { "version": "3.0.0", diff --git a/package.json b/package.json index 287fa72c..52c50609 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "lodash.merge": "^4.6.2", "multer": "^1.4.2", "ono": "^5.0.1", - "path-to-regexp": "^4.0.0", + "path-to-regexp": "^4.0.5", "ts-log": "^2.1.4" }, "devDependencies": { diff --git a/src/framework/base.path.ts b/src/framework/base.path.ts index fd26972d..85dfa9b1 100644 --- a/src/framework/base.path.ts +++ b/src/framework/base.path.ts @@ -1,4 +1,4 @@ -import * as pathToRegexp from 'path-to-regexp'; +import { compile } from 'path-to-regexp'; import { OpenAPIV3 } from './types'; interface ServerUrlVariables { @@ -56,7 +56,7 @@ export default class BasePath { }, []); const allParamCombos = cartesian(...allParams); - const toPath = pathToRegexp.compile(this.path); + const toPath = compile(this.path); const paths = new Set(); for (const combo of allParamCombos) { paths.add(toPath(combo)); diff --git a/src/middlewares/openapi.metadata.ts b/src/middlewares/openapi.metadata.ts index 2b34dc2d..61c8d694 100644 --- a/src/middlewares/openapi.metadata.ts +++ b/src/middlewares/openapi.metadata.ts @@ -1,4 +1,4 @@ -import * as pathToRegexp from 'path-to-regexp'; +import { pathToRegexp } from 'path-to-regexp'; import * as _ from 'lodash'; import { OpenApiContext } from '../framework/openapi.context'; import { OpenApiRequest, OpenApiRequestHandler } from '../framework/types';