graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

Strawberry Shake: fails to map properties from GraphQL response to .NET result object, resulting in .NET null values

Open ronnieholm opened this issue 2 years ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

In the Apollo Server sandbox environment, when I run the following query:

query Test {
  attribute(id: "A1002_338465", scope: "en-GB") {
    id
    scopeVariants(scopeFilter: {scopeIDs: ["en-GB", "da-DK"]}) {
      scope
      name
    }
  }
}

the output is:

{
  "data": {
    "attribute": {
      "id": "A1002_338465",
      "scopeVariants": [
        {
          "scope": "en-GB",
          "name": "Tailpiece size [mm]"
        },
        {
          "scope": "da-DK",
          "name": "Nippel dimension [mm]"
        }
      ]
    }
  }
}

Running the same query with StrawberryShake, in the result scopeVariants has become a two elements list, but with scope and name properties being null.

I've verified that StrawberryShake is indeed getting scope and name back from the GraphQL server. Placing a breakpoint in the generated code:

public global::StrawberryShake.IOperationResult<ITestResult> Build(global::StrawberryShake.Response<global::System.Text.Json.JsonDocument> response)
{
    ...
}

response has the following value:

{
  "data": {
    "attribute": {
      "__typename": "Attribute",
      "id": "A1002_338465",
      "scopeVariants": [
        {
          "__typename": "Attribute",
          "scope": "en-GB",
          "name": "Tailpiece size [mm]",
          "id": "A1002_338465"
        },
        {
          "__typename": "Attribute",
          "scope": "da-DK",
          "name": "Nippel dimension [mm]",
          "id": "A1002_338465"
        }
      ]
    }
  }
}

But for some reason, the values of scope and name aren't mapped onto the result.

Am I missing a setting somewhere or is this a bug with Strawberry?

I do wonder, though, why the Strawberry result has a different shape than that returned by Apollo Server sandbox environment.

Steps to reproduce

  1. See description above.

Relevant log output

See description above.

Additional Context?

No response

Product

Strawberry Shake

Version

12.11.1

ronnieholm avatar Jul 27 '22 10:07 ronnieholm