Closed nightroman closed 1 month ago
:( 12.16.0 has the same bug.
Internal reference: NEX-2488
I am closing this issue as this should not be problem with HC 13 and 14.
We still have this issue with HC 13.9.4 I have not tried yet with Fusion, it may take some time.
The same issue exists in Fusion 14.0.0-rc.2 @michaelstaib Could you please reopen the issue?
@michaelstaib Any action please? I will have to open the exact same issue in order not to be forgotten, this will be rather odd.
I have reproduced the error. But this is not allowed by the GraphQL spec. You have a filters: Map
here where Map
is a scalar. Basically an any scalar. The spec rule on validation does not have any notion of such scalars and the relation of variables in it. I guess the coercion at runtime would also have errors as variables in scalars is not specified.
I am closing this issue, as this is not a bug. However, I will do a PR with an error message specific to this problem. Something like variables are not allowed in scalar types.
I guess the coercion at runtime would also have errors as variables in scalars is not specified.
We do not have this issue with actual subgraph (GraphQL server in Go). But the HC gateway is not happy about "unused" variables.
Banana Cake Pop should show wiggles as it does in other cases of unused variables.
The spec about unused variables:
Each variable in variables must be used at least once in either the operation scope itself or any fragment transitively referenced by that operation.
There is no mention of scalars as a special case. To me, not a GraphQL guru, in our case all variables are used, our GraphQL is valid.
Maybe the spec should be explicit on this case with scalars (are scalar expressions in "operation scope itself" or not?). But until it's not, it's rather Hot Chocolate opinionated interpretation of the spec, in my hamble opinion.
I have started the discussion at the GraphQL spec repository https://github.com/graphql/graphql-spec/discussions/1115 and talked to several colleagues. So far everybody thinks variables are used in our case and the server error "sounds like a bug".
Is there an existing issue for this?
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
The
filter
type is the custom scalarMap
. The typeMap
is added to the server combined schema byAddType(new AnyType("Map"))
.Variables
Run query...
Actual result
The server returns an error:
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:
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:
Relevant log output
No response
Additional Context?
No response
Product
Hot Chocolate
Version
12.12.1