Color coded logging for missing request/response schemas in openapi

This commit is contained in:
Rory&
2026-03-17 02:23:23 +01:00
parent 6dc30c1f92
commit 4850d73e51
2 changed files with 35 additions and 5 deletions
+5 -2
View File
@@ -44,10 +44,13 @@ function formatPath(path) {
*/
function proxy(file, apiMethod, apiPathPrefix, apiPath, ...args) {
const opts = args.find((x) => x?.prototype?.OPTS_MARKER == true);
if (!opts)
return console.error(
if (!opts) {
console.error(
` \x1b[5m${bgYellow(black("WARN"))}\x1b[25m ${file.replace(path.resolve(__dirname, "..", "..", "dist"), "/src")} has route without route() description middleware: ${colorizeMethod(apiMethod)} ${formatPath(apiPath)}`,
);
routes.set(apiPathPrefix + apiPath + "|" + apiMethod, null);
return;
}
console.log(`${colorizeMethod(apiMethod).padStart("DELETE".length + 10)} ${formatPath(apiPathPrefix + apiPath)}`);
opts.file = file.replace("/dist/", "/src/").replace(".js", ".ts");