I’m trying to build a hierarchy of stories (to represent the tree of categories).
I’m unable to get any information from the Story linked via Single Option relation
Query:
CategoryItem(id: 'categories/b') {
id
name
content {
parent {
id
}
}
}
}
Results in the following (500 error)
SyntaxError: Unexpected token < in JSON at position 0
Anything that I’m doing wrong? In the JSON I can see that the reference is kept as UUID but GraphQL schema resolves parent as a field of Story type and forces accessing content via parent { ... } . Since accessing this kind of nested doesn’t seem to be supported there’s no way to even get to know the parent UUID (to query the data in separate query).
By the way, isn’t it a bit of a GraphQL anti-pattern? It seems like the query itself should be sufficient for determining whether relation needs to be resolved or not.
The reason for this is that you can resolve at maximum 100 relations in one call. In the case that you have more and want to use those UIDs in another way or request them selectively making it automatically would take the choice from the developers and give less control about this.