Skip to content

Fix basePath bug and add details to various validation debug messages.#21

Open
mschaef-da wants to merge 3 commits into
naz:masterfrom
mschaef-da:feature/specific-skipped-validation-messaging
Open

Fix basePath bug and add details to various validation debug messages.#21
mschaef-da wants to merge 3 commits into
naz:masterfrom
mschaef-da:feature/specific-skipped-validation-messaging

Conversation

@mschaef-da
Copy link
Copy Markdown
Contributor

No description provided.

mschaef-da and others added 3 commits December 4, 2018 15:28
Update module name passed to debug so that it matches both the instru…
Comment thread index.js
const matchUrlWithSchema = (reqUrl) => {
let url = parseUrl(reqUrl).pathname;
if (options.schema.basePath) {
url = url.replace(options.schema.basePath, '');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code will replace occurrences of the basepath that occur in the middle of the input URL. (As long as they are the first such instance.)

> const basePath = '/b';
undefined
> '/a/b/c/d'.replace(basePath, '')
'/a/c/d'

Comment thread index.js
const responseSchema = resolveResponseModelSchema(req, res);
if (!responseSchema) {
debug('Response validation skipped: no matching response schema');
debug(`Response validation skipped: no matching response schema for ${req.method} ${req.originalUrl}`);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent behind these changes is to make it easier to see which requests are not covered by a given schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant