express-validator icon indicating copy to clipboard operation
express-validator copied to clipboard

docs: mention `ContextBuilder` returned from `#check()`

Open fedeci opened this issue 3 years ago • 3 comments

Description

We mention in the docs that ContextBuilder is exposed in the result of #check() middleware.

~~This allows to get the properties of the builder.~~ ~~It can be used to create a library based on the context that will be built.~~ ~~(e.g. swagger docs generation)~~

~~I don't know if it is better to expose the properties in this way or to build a "local" context, @gustavohenke what do you think?~~

To-do list

  • [x] I have added tests for what I changed.
  • [x] This pull request is ready to merge.

fedeci avatar Jan 02 '21 22:01 fedeci

Coverage Status

Coverage remained the same at 100.0% when pulling 939bae65570505a1a9d2a21f538d49257a781dd9 on fedeci:get-builder-properties into 690cd636df27cd5d32ad4f0e3f6ca783d86f873f on express-validator:master.

coveralls avatar Jan 02 '21 22:01 coveralls

Yes, for example in check it is exposed here. Maybe we should just document this so that the end user could create his own context with all his methods and not only access properties through the builder. https://github.com/express-validator/express-validator/blob/7f15d2d963574f34e0e312a96228b7b0693df1cf/src/middlewares/check.ts#L32-L40

fedeci avatar Jan 13 '21 12:01 fedeci

Oops nope, asked review for the wrong PR😄

fedeci avatar Aug 08 '21 07:08 fedeci