-
-
Notifications
You must be signed in to change notification settings - Fork 627
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
(optional) null should be part of matchedData #568
Comments
Like previous version supported: |
Thanks for reporting this, @Danger89. Will need to add an option to include optional data, otherwise could break people's applications. |
Sure whatever is needed |
@gustavohenke export interface MatchedDataOptions {
filterOptionals: boolean;
onlyValidData: boolean;
locations: Location[];
} |
And waiting on a new release 👍 |
The interface is wrong |
First, thank you very much for the PR @gustavohenke Any estimated release date? I'm also affetected by this issue. See #605 |
I have been unable to dedicate much time to this project lately, that's why I haven't released it yet. |
Thank you very much for your answer and effort put in the project. Looking forward for the next release and hopping you manage to spare some time. This kind of projects can be very time consuming, so let me know if you need help with the release. |
Shipped on v5.3.0! 🚢 |
Current logic is not correct in my opinion.
matchedData() removes fields with If we pass Expected behavior is to pass Current workaround is to set includeOptionals = true and manually delete all undefined fields which is not great. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi,
TLDR:
matchedData()
is not returning my body field with JSON value ofnull
, while I try to validate the data with the check API.I don't know if I use your validator incorrect or if it's a feature request.. but..
I use your validator for my backend app before sending the JSON object further to the database (eg. MariaDB).
I have a database field what either can be of type integer or have the value of
NULL
. So I tried to use your validator in this way (at least this is what I thought should work):However, I'm also using the filter
matchedData()
function in order to guarantee that my data I put in my database is fully validated first by your validator package 👍Now, when I try to request an API call to the Express backend using your validator with the HTTP body:
Expected situation: I would expect the JSON object is now validated correctly and the journal_bank_id with null value becomes part of the returned object from
matchedData()
. Meaning the MySQL query will set the corresponding field to NULL accordantly. So basically I would expectmatchedData()
returns:{"journal_bank_id": null}
Actual situation:
matchedData()
is not returningjournal_bank_id
with valuenull
at all. Meaning my database field can't be set to NULL because of your validator.Do I miss something here? Should I maybe not use optional()? I couldn't find
isNull()
.. I have no clue anymore..Thanks in advance!
Kind regards,
Melroy van den Berg
The text was updated successfully, but these errors were encountered: