I got a data from js side, it looks like this
{
"selectionSet": {
"type": 1,
"selections": [
{
"name": {
"kind": "Name",
"value": "viewer"
},
"selectionSet": {
"type": 1,
"selections": [
{
"name": {
"kind": "Name",
"value": "avatarUrl"
},
"selectionSet": null
}
]
}
}
]
}
}
I'm wondering how to defined types for selectionSet
and selections
.
It seems that when defining selections
, I should have defined selectionSet
because it has a field whose type is selectionSet
. But when defined selectionSet
, I should have defined selections
Can someone answer it in OCaml style? I want to convert this JSON style data into a record.