I noticed that there was a previously closed issue related to optional fields
and whitespace handling.
However, in current versions of express-validator, when optional() is used
together with validation chains (e.g. isInt()), fields that contain only
whitespace can still produce validation errors with messages that are not
clear for API developers.
This seems especially confusing when sanitizers like trim() are used before
or after optional().
Example:
body('age').optional().trim().isInt()
If the client sends:
age=" "
The resulting validation error does not clearly explain why the value was
considered invalid, even though the field is optional.
This is a common real-world API scenario. Improving error clarity or behavior
here would help developers avoid confusion.