Skip to content

Conform with express-validator on parameter representation #431

Open
@yiliansource

Description

@yiliansource

body-parser and express-validator are both commonly used packages to process HTML forms. They are a pretty good fit aswell, since the parser allows the parsing of nested objects, and the validator allows the validation of nested objects. The shortcoming is when representing the param field of a validation error.

Currently, as far as I can see, there is no way to tell the body parser to use the "dot syntax", where nested objects are represented as my.nested.object instead of my[nested][object] in the HTML input names. The validator however, returns the parameter names in precisely this format, and I cannot seem to find a way to change this.

Is it possible to provide a parameter to the urlencoded options that allows the activation of qs's allowDots option? Then the fields names could be written in the dot format, parsed in the dot format and validated in the dot format.

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