feat: normalize paths before comparison

This commit is contained in:
Julian Lam
2020-12-14 15:24:46 -05:00
parent dbe85630e3
commit df8d62ba06
2 changed files with 5 additions and 2 deletions

View File

@@ -225,7 +225,7 @@ paths:
$ref: 'read/me.yaml' $ref: 'read/me.yaml'
/api/me/*: /api/me/*:
$ref: 'read/me.yaml' $ref: 'read/me.yaml'
"/api/uid/{uid}/*": "/api/uid/{uid*}":
$ref: 'read/uid/uid.yaml' $ref: 'read/uid/uid.yaml'
"/api/user/{userslug}": "/api/user/{userslug}":
$ref: 'read/user/userslug.yaml' $ref: 'read/user/userslug.yaml'

View File

@@ -187,7 +187,10 @@ describe('API', async () => {
return paths; return paths;
}; };
const paths = buildPaths(webserver.app._router.stack); const paths = buildPaths(webserver.app._router.stack).map(function normalize(pathObj) {
pathObj.path = pathObj.path.replace(/\/:([^\\/]+)/g, '/{$1}');
return pathObj;
});
// For each express path, query for existence in read and write api schemas // For each express path, query for existence in read and write api schemas
paths.forEach((pathObj) => { paths.forEach((pathObj) => {