@terreno/api 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -69,7 +69,14 @@ module.exports = function generateDocument(baseDocument, router, basePath) {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
operation.parameters = params_1;
|
|
72
|
-
|
|
72
|
+
try {
|
|
73
|
+
path = pathToRegexp.compile(path.replace(/\*|\(\*\)/g, '(.*)'))(keys_1, { encode: function (value) { return value; } });
|
|
74
|
+
}
|
|
75
|
+
catch (_e) {
|
|
76
|
+
// Express 5 stores path params in matchers instead of layer.keys, so keys
|
|
77
|
+
// may be incomplete. Fall back to simple regex replacement of :param → {param}.
|
|
78
|
+
path = path.replace(/:([a-zA-Z0-9_]+)/g, '{$1}');
|
|
79
|
+
}
|
|
73
80
|
}
|
|
74
81
|
doc.paths[path] = doc.paths[path] || {};
|
|
75
82
|
doc.paths[path][layer.method] = operation;
|
package/package.json
CHANGED
|
@@ -67,7 +67,13 @@ module.exports = function generateDocument (baseDocument, router, basePath) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
operation.parameters = params
|
|
70
|
-
|
|
70
|
+
try {
|
|
71
|
+
path = pathToRegexp.compile(path.replace(/\*|\(\*\)/g, '(.*)'))(keys, { encode: (value) => value })
|
|
72
|
+
} catch (_e) {
|
|
73
|
+
// Express 5 stores path params in matchers instead of layer.keys, so keys
|
|
74
|
+
// may be incomplete. Fall back to simple regex replacement of :param → {param}.
|
|
75
|
+
path = path.replace(/:([a-zA-Z0-9_]+)/g, '{$1}')
|
|
76
|
+
}
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
doc.paths[path] = doc.paths[path] || {}
|