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
docs: mention ContextBuilder
returned from #check()
#972
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it is better to expose the properties in this way or to build a "local" context
Hmm I don't mind either way at the moment. The Context interface is quite small, so this looks reasonable for now.
I don't recall if the .builder
property is exposed/documented anywhere... do you think it would make more sense to put it in
express-validator/src/chain/context-handler.ts
Lines 5 to 9 in 7f15d2d
export interface ContextHandler<Chain> { | |
bail(): Chain; | |
if(condition: CustomValidator | ValidationChain): Chain; | |
optional(options?: Partial<Optional> | true): Chain; | |
} |
Yes, for example in express-validator/src/middlewares/check.ts Lines 32 to 40 in 7f15d2d
|
741b357
to
d4250a2
Compare
ContextBuilder
returned from #check()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will LGTM if we can add more docs than just this 😬
- API entry
- Possibly an entry under "Features", if it's necessary to showcase more of it
d4250a2
to
939bae6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...did you want to address the previous review?
Oops nope, asked review for the wrong PR😄 |
3177f64
to
6e160b1
Compare
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