-
Notifications
You must be signed in to change notification settings - Fork 17
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
skip_uninitialized_values
not working ?
#189
Comments
When you type property with default value it already initialized on creation, so if you just remove |
Thanks for answer :) Yes for that case, but in case you only want to update partially a resource, if |
Can you provide full example with configuration for |
Check here: If I want to only update partially a resource, by setting only If |
I see now, for me, it's working because I was mapping from array/stdClass. |
OK, thanks for your time, make it by hand need some effort that is not really needed in my case ^^ I think the preferable solution will be to split |
Indeed we don't support |
I started working on this mater and got something working, I need to fix some tests but the feature is there if you wanna take a look at it: #200 |
I am trying to map a payload for a PATCH endpoint and would like to configure it so that:
null
, it should update the field tonull
(if the field is nullable).However, the current behavior of
skip_uninitialized_values
is not working.I have also tried using
skip_null_values
, but this is problematic because it skips both uninitialized andnull
values. In cases where a field is nullable (e.g.,birthdate
), this prevents setting a nullable field tonull
during a PATCH operation.Example:
Here’s a basic example of my
User
entity:In a PATCH request, I would like the following behavior:
birthdate
is not provided in the payload, it should remain unchanged.birthdate
is explicitly set tonull
in the payload, it should be updated tonull
in the entity.Here’s what the request payload might look like:
Expected Behavior:
birthdate
) should be updated tonull
if explicitly set tonull
.Current Behavior:
skip_uninitialized_values
does not skip uninitialized properties as expected.skip_null_values
skips both uninitialized andnull
values, making it impossible to set a nullable field tonull
in a PATCH request.Steps to Reproduce:
User
entity with a nullable field (e.g.,birthdate
).null
.null
.Questions:
The text was updated successfully, but these errors were encountered: