expressjs / expressjs/body-parser

Conform with express-validator on parameter representation

Open
#431 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.5k
Forks
767
Avg merge
13h 53m
Merged PRs (30d)
10

Description

`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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.