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
How to keep keys for optional fields in matchedData? #1273
Labels
Comments
2 tasks
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
I want to keep keys for optional fields in request body in
matchedData
return value.To Reproduce
Let's say we have user model.
In frontend, user removed first name. and other fields are not changed.
So frontend sends request with only changed fields.
In this case
matchedData
function returns empty JSON, but I would like to keepfirstName
key.There is a parameter called
includeOptional
, but if we set that parameter to True,matchedData
function returns JSON which contains bothfirstName
andlastName
as key.Moreover, I think it's more accurate that if keys exist in both request and validation schema, it should exist in
matchedData
return value.Environment:
The text was updated successfully, but these errors were encountered: