drupal-graphql / drupal-graphql/graphql
When queries entity field reference without value multiple errors are display
- Dominant language
- PHP
- Stars
- 287
- Forks
- 198
- PR merge metrics
- No merged PRs in 30d
Description
I created a query based on the example module, but with a custom entity content with field references.
I query all fields, and if the references exists there are no problem, but when try to query an entity that does not have references the following errors are showed.
- Query:
```
{
getProjects(uuid: "28077916-0cd4-4754-b8c2-7f10dcfccd7e", offset: 0, limit: 1) {
items {
id
uuid
title
author
list {
uuid
title
manipulation {
id
uuid
title
author
targetCssSelector
}
}
}
}
}
```
- Response:
```
{
"data": {
"getProjects": {
"items": [
{
"id": 20,
"uuid": "28077916-0cd4-4754-b8c2-7f10dcfccd7e",
"title": "HELLO GRAPHQL 5",
"author": "Graphql",
"list": [
{
"uuid": "362d2002-e6a3-4f58-a5a5-8a390d23ba40",
"title": "HELLO URL GRAPHQL",
"manipulation": {
"id": null,
"uuid": "",
"title": null,
"author": null,
"targetCssSelector": ""
}
}
]
}
]
}
},
"extensions": [
{
"message": "Call to a member function id() on boolean",
"locations": [
{
"line": 12,
"column": 6
}
],
"path": [
"getProjects",
"items",
0,
"list",
0,
"manipulation",
"id"
]
},
{
"message": "Argument 1 passed to Drupal\\graphql\\Plugin\\GraphQL\\DataProducer\\Entity\\EntityLabel::resolve() must implement interface Drupal\\Core\\Entity\\EntityInterface, boolean given",
"locations": [
{
"line": 14,
"column": 6
}
],
"path": [
"getProjects",
"items",
0,
"list",
0,
"manipulation",
"title"
]
},
{
"message": "Argument 1 passed to Drupal\\graphql\\Plugin\\GraphQL\\DataProducer\\Entity\\EntityOwner::resolve() must implement interface Drupal\\Core\\Entity\\EntityInterface, boolean given",
"locations": [
{
"line": 15,
"column": 6
}
],
"path": [
"getProjects",
"items",
0,
"list",
0,
"manipulation",
"author"
]
}
]
}
```
Documentation:
Example based on https://github.com/drupal-graphql/graphql/blob/8.x-4.x/examples/src/Plugin/GraphQL/DataProducer/QueryArticles.php
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.