ChilliCream / ChilliCream/graphql-platform

Mixed entities in query results

Open
#6,163 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ strawberry shake
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
Product

Strawberry Shake

Describe the bug

When calling below query I'm getting mixed data:

query GetShapesByTenant($tenantId: ID!) {
  shape {
    getMany(tenantId: $tenantId) {
      components {
        config {
          ... on ContentChunkComponentConfig {
            components {
              type
              id
            }
          }
        }
        id
        type
      }
      identifier
      variantComponents {
        config {
          ... on ContentChunkComponentConfig {
            components {
              type
              id
            }
          }
        }
        id
        type
      }
    }
  }
}
Steps to reproduce

Because my GraphQL API is not public, I have implemented some code to show what actually is happening.

In a solution you can find DataTest.cs with single unit test, the result of the test shows what's wrong. What I'm doing in the test, first of all, I'm calling for my data using StrawberryShake client but feeding it with previously intercepted response body from real call. Then deserialising the same response body. At the end I compare results to show differences.

Results:

Expected property shakeComponents.Config.Components to be a collection with 4 item(s), but {
    StrawberryShakeTest.Pim.GetShapesByTenant_Shape_GetMany_Components_Config_Components_ShapeComponent
    {
        Id = "sap-id", 
        Type = ComponentType.Singleline {value: 14}
    }, 
    StrawberryShakeTest.Pim.GetShapesByTenant_Shape_GetMany_Components_Config_Components_ShapeComponent
    {
        Id = "web-area", 
        Type = ComponentType.Selection {value: 13}
    }, 
    StrawberryShakeTest.Pim.GetShapesByTenant_Shape_GetMany_Components_Config_Components_ShapeComponent
    {
        Id = "lastchangedtimestamp", 
        Type = ComponentType.Datetime {value: 3}
    }, 
    StrawberryShakeTest.Pim.GetShapesByTenant_Shape_GetMany_Components_Config_Components_ShapeComponent
    {
        Id = "sap-category", 
        Type = ComponentType.Singleline {value: 14}
    }, 
    StrawberryShakeTest.Pim.GetShapesByTenant_Shape_GetMany_Components_Config_Components_ShapeComponent
    {
        Id = "sap-description", 
        Type = ComponentType.Singleline {value: 14}
    }, 
    StrawberryShakeTest.Pim.GetShapesByTenant_Shape_GetMany_Components_Config_Components_ShapeComponent
    {
        Id = "hazardous-waste", 
        Type = ComponentType.Boolean {value: 0}
    }, 
    StrawberryShakeTest.Pim.GetShapesByTenant_Shape_GetMany_Components_Config_Components_ShapeComponent
    {
        Id = "availableforweb", 
        Type = ComponentType.Boolean {value: 0}
    }
}
"
"contains 3 item(s) more than"
"{
    StrawberryShakeTest.Component
    {
        Config = <null>, 
        Id = "sap-id", 
        Type = ComponentType.Singleline {value: 14}
    }, 
    StrawberryShakeTest.Component
    {
        Config = <null>, 
        Id = "sap-title", 
        Type = ComponentType.Singleline {value: 14}
    }, 
    StrawberryShakeTest.Component
    {
        Config = <null>, 
        Id = "modified-at", 
        Type = ComponentType.Singleline {value: 14}
    }, 
    StrawberryShakeTest.Component
    {
        Config = <null>, 
        Id = "manufacturer-id", 
        Type = ComponentType.Singleline {value: 14}
    }
}
.

As you can see on above example, components are mixed, those which shouldn't be there, are present in other shapes.

Relevant log output

No response

Additional Context?

No response

Version

12.18.0

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.

Research direction

Start with DataTest.cs in the linked StrawberryShakeTest reproduction and run its unit test to observe the mismatch between Strawberry Shake’s result and deserializing the same response body directly. Compare the component collections in both results; done means the client no longer includes components belonging to other shapes.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, graphql
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.