Skip to content

Conversation

@Vladyslav531
Copy link

@Vladyslav531 Vladyslav531 commented Jan 30, 2024

Description

Add ignoreUndefined to includeOptionals in matchedData

ignoreUndefined allows user to pass optional values which aren't undefined like null and falsy values.
It keeps current behaviour and allow user to customize matchedData.

Closes #1048
Closes #1175
Closes #1273

To-do list

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

@Vladyslav531
Copy link
Author

@gustavohenke Could you check this PR please?

@coveralls
Copy link

coveralls commented Feb 13, 2024

Coverage Status

coverage: 100.0%. remained the same
when pulling 5e783d3 on Vladyslav531:feat/ignoreUndefined
into ffd7994 on express-validator:master.

Copy link
Member

@fedeci fedeci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks like a good new feature, there are some changes to publish this in a minor version.

Copy link
Member

@fedeci fedeci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks like a good new feature, there are some changes to publish this in a minor version.

@fedeci fedeci changed the title feat: ignoreUndefined in includeOptional feat(matchedData): add ignoreUndefined option when selecting fields Feb 16, 2024
@fedeci
Copy link
Member

fedeci commented Feb 16, 2024

Also, docs should be updated too once we are good to go with the implementation and the new API.

@Vladyslav531
Copy link
Author

Also, docs should be updated too once we are good to go with the implementation and the new API.

I update docs, you can check

@Vladyslav531 Vladyslav531 requested a review from fedeci February 16, 2024 16:39
@Vladyslav531
Copy link
Author

@fedeci I updated code to keep signature of context. You can check again

@Vladyslav531 Vladyslav531 requested a review from fedeci February 20, 2024 15:13
@fedeci
Copy link
Member

fedeci commented Feb 20, 2024

I also changed my mind on the naming of ignoreUndefined. It may be confusing. What about discardUndefined?
/cc @gustavohenke

@fedeci fedeci requested a review from gustavohenke February 20, 2024 17:51
@Vladyslav531
Copy link
Author

I also changed my mind on the naming of ignoreUndefined. It may be confusing. What about discardUndefined? /cc @gustavohenke

I think it is also good name.

@Vladyslav531 Vladyslav531 changed the title feat(matchedData): add ignoreUndefined option when selecting fields feat(matchedData): add discardUndefined option when selecting fields Feb 20, 2024
@Vladyslav531 Vladyslav531 requested a review from fedeci February 21, 2024 11:32
@Vladyslav531 Vladyslav531 force-pushed the feat/ignoreUndefined branch from 5e783d3 to 2a0b06b Compare August 7, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to keep keys for optional fields in matchedData? matchedData does not include nullable optionals

3 participants