Commit a8cd01f
committed
Fix error when single query is anonymous.
```
"{\"query\":\"query {\\n greeting(who: \\\"Tim\\\")\\n}\"}"
```
Notice that the query (immediately after the start of the JSON field
`query:`) has no operationName, i.e. it's anonymous.
This gets decoded to:
```
Just (GraphQLPostRequest {query = "query {\n greeting(who: \"Tim\")\n}", operationName = "", variables = fromList []})
```
by a custom/temporary Aeson parser.
:blush: I didn't record it, and now it's gone. Something along the lines
of: `Just(Error{"query document error!definition error!query"})`
Not exactly, but that was the gist of it.
Realized that the parser might be choking on the absence of the
`operationName`, so tried to apply `optempty` to `nameParser` but Name
was not an instance of Monoid. Changed that and ¡viola! it worked
(sounds easy, but I learned something about applying Monoid to a newtype,
and also picked up a prior mistake where I forgot to import Data.Text).
On a side note, the 'custom/temporary' Aeson parser does not yet solve
the ambiguous `variables` problem mentioned here:
and here:
and obliquely here:1 parent d27f591 commit a8cd01f
2 files changed
+16
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
38 | 53 | | |
39 | 54 | | |
40 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
0 commit comments