Handle UNSET values in the strawberry schema.#3050
Handle UNSET values in the strawberry schema.#3050patrick91 merged 2 commits intostrawberry-graphql:mainfrom
Conversation
|
Thanks for adding the Here's a preview of the changelog:
For codegen, we treat the Here's the preview release card for twitter: Here's the tweet text: |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3050 +/- ##
=======================================
Coverage 96.54% 96.54%
=======================================
Files 468 468
Lines 29197 29201 +4
Branches 3591 3592 +1
=======================================
+ Hits 28189 28193 +4
Misses 827 827
Partials 181 181 |
CodSpeed Performance ReportMerging #3050 will not alter performanceComparing Summary
|
patrick91
left a comment
There was a problem hiding this comment.
Looks good! We only need the release file 😊 and I'm adding a note
|
|
||
| type PersonInput = { | ||
| name: string | ||
| age: number | undefined |
There was a problem hiding this comment.
My typescript isn't that great, but I think that the intent is that personInput.age would be unset (undefined) in the request payload (rather than having it be null). My typescript isn't that great -- but at least JS has a better way to express that "this key was never set" (undefined) vs. "this key was set to some default 'missing' value" (null). I think that UNSET most closely maps to the "this key was never set" semantics -- so undefined seems like the right choice to me here...
The codegen currently chokes on `strawberry.UNSET` default values. This PR updates the codegen to stop raising an exception and instead pass a `GraphQLNullValue(value=UNSET)` to the plugins. The default python plugin writes a `None` as the default value because there really isn't a well understood concept of UNSET in the python eco system. User defined plugins have all the information that they need to handle this differently if they choose to do so.
* Handle UNSET values in the strawberry schema. The codegen currently chokes on `strawberry.UNSET` default values. This PR updates the codegen to stop raising an exception and instead pass a `GraphQLNullValue(value=UNSET)` to the plugins. The default python plugin writes a `None` as the default value because there really isn't a well understood concept of UNSET in the python eco system. User defined plugins have all the information that they need to handle this differently if they choose to do so. * Add RELEASE.md file. --------- Co-authored-by: Matt Gilson <mgilson@lat.ai>


The codegen currently chokes on
strawberry.UNSETdefault values. This PR updates the codegen to stop raising an exception and instead pass aGraphQLNullValue(value=UNSET)to the plugins. The default python plugin writes aNoneas the default value because there really isn't a well understood concept ofUNSETin the python ecosystem. User defined plugins have all the information that they need to handle this differently if they choose to do so.Description
Types of Changes
Issues Fixed or Closed by This PR
Checklist