diegohaz/bodymen

Issue with required field type

SeyTo opened this issue · 0 comments

SeyTo commented

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?