The pelias-parser CLI has a nice debug output of all the solutions generated, however this isn't available via the API debug view, this is annoying since it requires copy->pasting the input across to the terminal to inspect the parser behaviour.
In the past I thought we couldn't really take advantage of the Debug functionality in the sanitizer/* modules because we don't have access to req like we do in the middleware/* modules.
The minor change I made to sanitizer/sanitizeAll.js in this PR exposes the req param to all sanitisers in a backward compatible way.
The rest of this PR is an implementation of that workflow where we use the same logic from the parser CLI to print a concise summary of each solution.
The
pelias-parser
CLI has a nice debug output of all the solutions generated, however this isn't available via the API debug view, this is annoying since it requires copy->pasting the input across to the terminal to inspect the parser behaviour.In the past I thought we couldn't really take advantage of the
Debug
functionality in thesanitizer/*
modules because we don't have access toreq
like we do in themiddleware/*
modules.The minor change I made to
sanitizer/sanitizeAll.js
in this PR exposes thereq
param to all sanitisers in a backward compatible way.The rest of this PR is an implementation of that workflow where we use the same logic from the parser CLI to print a concise summary of each solution.