Open chillu opened 5 years ago
@unclecheese Just to minimise confusion here, could you validate my assumptions here?
<typeWithDescendants>
worked, and was documented accordinglyDemo of the current issue in 3.0.1
:
graphql.yml
SilverStripe\Control\Director:
rules:
'graphql': '%$SilverStripe\GraphQL\Controller.default'
SilverStripe\GraphQL\Manager:
schemas:
default:
scaffolding:
types:
Page:
fields: '*'
operations:
read: true
SilverStripe\ErrorPage\ErrorPage:
fields: [ErrorCode]
query readPages {
readPages {
edges {
node {
Title
ErrorCode
}
}
}
}
Response
{
"data": null,
"errors": [
{
"message": "Cannot query field \"ErrorCode\" on type \"Page\".",
"locations": [
{
"line": 6,
"column": 9
}
]
}
]
}
This doesn't work either
graphql.yml
SilverStripe\Control\Director:
rules:
'graphql': '%$SilverStripe\GraphQL\Controller.default'
SilverStripe\GraphQL\Manager:
schemas:
default:
scaffolding:
types:
Page:
fields: [Title,ErrorCode]
operations:
read: true
SilverStripe\ErrorPage\ErrorPage:
fields: [ErrorCode]
Response
{
"errors": [
{
"message": "Invalid field \"ErrorCode\" on Page",
"code": 0,
"file":
I was questioning wat the current way of working with descendants is, or if there is an alternative to <type>WithDescendants
for version 3.2.3? Those types don't show up in my introspection.
Using the union method as described in the readme section results in the following error: Fragment cannot be spread here as objects of type \"Block\" can never be of type \"VideoBlock\".
I'm asking here because i'm not quite sure what to do, and if this is still a work in progress should the readme be updated stating that it is a WIP feature?
The docs say that you get
<type>WithDescendants
, but you don't. It's unclear when that happend, but it's a regression which versioned-admin and elemental now rely on. They can't just change their query to use descendant based logic, because that would force them to dynamically create those queries (based on the available types in a particular SilverStripe project).We could fix this through https://github.com/silverstripe/silverstripe-graphql/issues/209 (RFC: Replace "descendant unions" with fields to simplify querying), but that seems like a long time to leave this regression in the module.
This has also come up with devs on the #graphql channel just now