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

Issue with required field type #31

Open
SeyTo opened this issue Mar 20, 2020 · 0 comments
Open

Issue with required field type #31

SeyTo opened this issue Mar 20, 2020 · 0 comments

Comments

@SeyTo
Copy link

SeyTo commented Mar 20, 2020

Reproduction:
Using a basic express prototype:

router.post(
  '/',
  bodymen.middleware({
    fieldA: { type: String, required: true },
    fieldB: { type: String, required: "randomstring" },
    fieldC: { type: String, required: () => { return false } }
  }),
  (req, res, next) => {
     res.end("done")
  }
)   

All the 3 fields fieldA .. C becomes a required = true case. Calling it will return that all fields are required. I was hoping that atleast 'fieldC' should work as expected.
Did I miss anything?

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