Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No validator found when dot in path #75

Open
nodeneil opened this issue Oct 1, 2021 · 0 comments
Open

No validator found when dot in path #75

nodeneil opened this issue Oct 1, 2021 · 0 comments

Comments

@nodeneil
Copy link

nodeneil commented Oct 1, 2021

Validators are not loaded when the request path has a dot, for example app/v1.0/path/to/resource.

The issue is caused by getValidatorByPathMethodAndCode in schema-utils, which uses lodash to navigate the schema object graph:

return get(schema, `${route}.${request.method}.responses.${response.status}`);

Since route in this case includes a dot lodash interprets this as a key delimiter and the validator is not found.

This change resolves the issue:

return get(schema[route] || {}, `${request.method}.responses.${response.status}`);
nodeneil pushed a commit to nodeneil/api-contract-validator that referenced this issue Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant