Comments (12)
@ShtykovaAA you can do that using UNSET
: https://play.strawberry.rocks/?gist=a70bc1aa74d5d04a6ceea1be6a7b7575
https://strawberry.rocks/docs/types/input-types#defining-input-types
from strawberry.
@patrick91 it works! thank you!
from strawberry.
@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?
from strawberry.
@ShtykovaAA cab you make an example in the playground? I think pydantic should work there
from strawberry.
@patrick91 yes! here an example https://play.strawberry.rocks/?gist=fdff10f784dd786a67d2e74bbab95d77
from strawberry.
@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...
from strawberry.
@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!
from strawberry.
@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
from strawberry.
@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 π
from strawberry.
Related Issues (20)
- Support both Pydantic 1 and 2 HOT 1
- Add support for framework's specific upload type
- Schema basics docs HOT 2
- Should we hide fields that starts with `_` by default?
- buggy generic interfaces HOT 3
- Add support of permission_classes for type decorator
- Visual bug in documentation HOT 2
- Allow `strawberry.auto | None` in Pydantic
- strawberry.ext.mypy_plugin PydanticModelField.to_argument error HOT 2
- make to_pydantic function recursive
- Unable to hide field in derived type HOT 1
- Execution Context errors
- Expose common request on extensions' context
- Add support for using FastAPI APIRouter arguments in GraphQLRouter HOT 1
- Feature Request: Info context in scalar serialization HOT 2
- Broken documentation examples in page https://strawberry.rocks/docs/guides/dataloaders HOT 6
- `print_schema` does not prefix the `extend` keyword when Schema uses apollo federation HOT 3
- Improve how we find concrete type for generic in interfaces (and potentially unions)
- Add better support for nested generics
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from strawberry.