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

HotChocolate emits check error SS0002 for valid GraphQL

Open nightroman opened this issue 3 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

HotChocolate emits check error SS0002 for valid GraphQL

Steps to reproduce

The issue may be reproduced in different HotChocolate products, server and client.

Server

Use Banana Cake Pop in order to reproduce the issue. Create a document with the following parts:

Schema endpoint

https://api.nexar.com/graphql/

Query

query Search($product: String!, $capacitance: Float!, $tolerance: Int!, $voltagerating_dc: Int!) {
  supSearch(
    country: "NL"
    currency: "EUR"
    distributorApiTimeout: "3s"
    q: $product
    filters: {capacitance: $capacitance, tolerance: $tolerance, voltagerating_dc_: $voltagerating_dc}
    start: 0
    limit: 5
  ) {
    hits
    results {
      part {
        id
        name
        mpn
        specs {
          attribute {
            name
          }
          value
        }
      }
    }
  }
}

The filter type is the custom scalar Map. The type Map is added to the server combined schema by AddType(new AnyType("Map")).

Variables

{
   "product": "ceramic capacitor",
    "capacitance" : 0.0000001,
    "voltagerating_dc": 50,
    "tolerance": 10
}

Run query...

Actual result

The server returns an error:

"message": "The following variables were not used: capacitance, tolerance, voltagerating_dc."

Note, this is the server error, not client. BCP is happy with the definition of the query. BCP correctly treats all variables as defined.

If we, for example, remove the line with filter then only BCP show wiggles and tooltips "Variable $capacitance is never used in the operation Search.".

Expected result

With a proper token specified, the query should work and return data.

Without a token, the expected result is this error:

"message": "Token validation failed. Please provide a valid access token."

Client

The attached project is StrawberryShake client configured for the same scenario. It contains the single query, the above problematic.

Nexar.Client.zip

Build the project. The build fails with this error:

...\Nexar.Client\Query.graphql(2,2): error SS0002: The following variables were not used: capacitance, tolerance, voltagerating_dc.

Relevant log output

No response

Additional Context?

No response

Product

Hot Chocolate

Version

12.12.1

nightroman avatar Sep 06 '22 11:09 nightroman

:( 12.16.0 has the same bug.

nightroman avatar Jan 04 '23 19:01 nightroman

Internal reference: NEX-2488

RobAltium avatar Jan 23 '24 23:01 RobAltium