HotChocolate emits check error SS0002 for valid GraphQL
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.
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
:( 12.16.0 has the same bug.
Internal reference: NEX-2488