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

Conform with express-validator on parameter representation #431

Open
yiliansource opened this issue Mar 31, 2021 · 0 comments
Open

Conform with express-validator on parameter representation #431

yiliansource opened this issue Mar 31, 2021 · 0 comments

Comments

@yiliansource
Copy link

yiliansource commented Mar 31, 2021

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.

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

No branches or pull requests

1 participant