Open ShtykovaAA opened 5 months ago
@ShtykovaAA you can do that using UNSET
: https://play.strawberry.rocks/?gist=a70bc1aa74d5d04a6ceea1be6a7b7575
https://strawberry.rocks/docs/types/input-types#defining-input-types
@patrick91 it works! thank you!
@patrick91 sorry I checked that it doesn't work for @strawberry.experimental.pydantic.input(PydanticModel)
and I want to fix it, do I need another conversation?
@ShtykovaAA cab you make an example in the playground? I think pydantic should work there βΊοΈ
@patrick91 yes! here an example https://play.strawberry.rocks/?gist=fdff10f784dd786a67d2e74bbab95d77
@patrick91 I found the place of mistake: https://github.com/graphql-python/graphql-core/blob/main/src/graphql/utilities/coerce_input_value.py#L102
So if I'm using strawberry.input
the default value is Undefined, but than I'm using @strawberry.experimental.pydantic.input(PydanticModel)
the default value is None...
@ShtykovaAA thanks for checking! I might have some time to fix this during the weekend, or feel free to send a PR if you find a way to fix it!
@patrick91 I'm newbie but I really want to take a chance
I think we need to check this condition https://github.com/strawberry-graphql/strawberry/blob/main/strawberry/experimental/pydantic/object_type.py#L76 because it means that we are overwriting our strawberry.input
by PydanticField and that's why the default value is None
, but not UNSET
.
what do you think about it? I think it's a big change in project, but I think that it's supposed to be like that
@ShtykovaAA I'm not too sure! Feel free to try and send a draft PR, we should have enough test to make sure this becomes a valid change π
@patrick91 hi! I added draft pr, tell me if there will be time to look/discuss my changes?
@ShtykovaAA can you link the PR here? π
@patrick91 yes, sure https://github.com/strawberry-graphql/strawberry/pull/3469
Hi!
I have an example, where I want to update some fields in my entity, here is my example https://play.strawberry.rocks/?gist=67964a59e64b5c3c6bdce477826db9f5
So details: I want to update some fields from frontend, I want to know what exactly fields were sent to backend, but function return all input object with default None value.
It's important because some fields could be null in database.
Upvote & Fund