Skip to content

No validator found when dot in path #75

@nodeneil

Description

@nodeneil

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}`);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions