micronaut-graphql
micronaut-graphql copied to clipboard
Fails to parse valid Apollo subscription messages which contain extensions field
Describe the bug
Apollo sends an extensions: {}
field with subscription queries like so:
{
"id": "1",
"type": "start",
"payload": {
"variables": {
"_v0_symbol": "btcusd"
},
"extensions": {},
"operationName": null,
"query": "subscription ($_v0_symbol: String) { ticker(symbol: $_v0_symbol) { average createdAtTimestamp }}"
}
}
Unless extensions
is removed or changed to undefined
then the java graphql server refuses to parse the valid message. In Micronaut v1 it threw a JSON parse exeption, in Micronaut v2 it doesn't throw but a response is not sent unless extensions is undefined or not present.
To Reproduce
Send a query with extensions: {}
for example:
{
"id": "1",
"type": "start",
"payload": {
"variables": {
"marketId": "BTCUSD"
},
"extensions": {},
"operationName": "TickerForTradeSubscription",
"query": "subscription TickerForTradeSubscription($marketId: String!) {\n ticker(symbol: $marketId) {\n symbol\n open\n low\n high\n baseVolume\n bestBid\n bestAsk\n last\n lastTradeSize\n createdAtTimestamp\n __typename\n }\n}\n"
}
}
Environment Information
- Operating System: MacOS & Docker
- Micronaut Version: v2
- JDK Version: 11
Can you please share an app that reproduces the issue?
Seems like they should/could be added to https://github.com/micronaut-projects/micronaut-graphql/blob/master/graphql/src/main/java/io/micronaut/configuration/graphql/GraphQLRequestBody.java but it's a bit lame to just make it a valid object, and further ignore extensions.