ChilliCream / ChilliCream/graphql-platform

Strawberry Shake: Runtime ArgumentNullException caused by possible code generation bug when mapping response into "Data" object

Open
#5,349 1 comment 0 reactions 1 assignee View on GitHub

@michaelstaib is already working on this.

Since Sep 8, 2022.

🌶️ strawberry shake 🔍 investigate
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

Is there an existing issue for this?
  • I have searched the existing issues
Describe the bug

I'm in the situation where shake is not able parse the response and throws.

Steps to reproduce

I have created a repro repo where you can find my query that causes the problem.

I have a Listing. Listing is implemented by ListingSimple and Projekt. ListingSimple is implemented by Offer and Auction. Project has a field listings that is selection wrapper around [ListingSimple!]!.

I also have a query listing(..): [Listing]! where I would like to query all project listings. But it seems that Shake threats all Listings the same - I mean that if I query for non nullable field in "child project listings" it also nullchecks for that field in the "parent project listing" even though I did not query for that particular field (it is not present in the response) so an ArgumentNullException is thrown.

Relevant log output
System.ArgumentNullException: Value cannot be null.
   at Logic.Graphql.Generated.State.GetProjectDetailItemsResultFactory.MapNonNullableIGetProjectDetailItems_Listing_Listings_SatisfiesFilter_Items(IListingData data, IEntityStoreSnapshot snapshot) in /Users/janbejvl/Development/Infinityloop/nemovizor-client/NemovizorBridgeShake/Generated/BridgeClient.StrawberryShake.cs:line 126814
   at Logic.Graphql.Generated.State.GetProjectDetailItemsResultFactory.MapNonNullableIGetProjectDetailItems_Listing_Listings_SatisfiesFilter_ItemsNonNullableArray(IReadOnlyList`1 list, IEntityStoreSnapshot snapshot) in /Users/janbejvl/Development/Infinityloop/nemovizor-client/NemovizorBridgeShake/Generated/BridgeClient.StrawberryShake.cs:line 126787
   at Logic.Graphql.Generated.State.GetProjectDetailItemsResultFactory.MapNonNullableIGetProjectDetailItems_Listing_Listings_SatisfiesFilter(ListingSelectionData data, IEntityStoreSnapshot snapshot) in /Users/janbejvl/Development/Infinityloop/nemovizor-client/NemovizorBridgeShake/Generated/BridgeClient.StrawberryShake.cs:line 126767
   at Logic.Graphql.Generated.State.GetProjectDetailItemsResultFactory.MapNonNullableIGetProjectDetailItems_Listing_Listings(ProjectListingsData data, IEntityStoreSnapshot snapshot) in /Users/janbejvl/Development/Infinityloop/nemovizor-client/NemovizorBridgeShake/Generated/BridgeClient.StrawberryShake.cs:line 126752
   at Logic.Graphql.Generated.State.GetProjectDetailItemsResultFactory.MapNonNullableIGetProjectDetailItems_Listing(IListingData data, IEntityStoreSnapshot snapshot) in /Users/janbejvl/Development/Infinityloop/nemovizor-client/NemovizorBridgeShake/Generated/BridgeClient.StrawberryShake.cs:line 126737
   at Logic.Graphql.Generated.State.GetProjectDetailItemsResultFactory.Create(IOperationResultDataInfo dataInfo, IEntityStoreSnapshot snapshot) in /Users/janbejvl/Development/Infinityloop/nemovizor-client/NemovizorBridgeShake/Generated/BridgeClient.StrawberryShake.cs:line 126718
   at Logic.Graphql.Generated.State.GetProjectDetailItemsBuilder.BuildData(JsonElement obj) in /Users/janbejvl/Development/Infinityloop/nemovizor-client/NemovizorBridgeShake/Generated/BridgeClient.StrawberryShake.cs:line 144275
   at Logic.Graphql.Generated.State.GetProjectDetailItemsBuilder.Build(Response`1 response) in /Users/janbejvl/Development/Infinityloop/nemovizor-client/NemovizorBridgeShake/Generated/BridgeClient.StrawberryShake.cs:line 144237
Additional Context?

image

Note: I'm 100% sure that there is no null value in non-nullable field.

Product

Strawberry Shake

Version

12.12.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.