Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node query to GraphQl schema #852

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
},
"drupal/gin": {
"Issue #3455558: There is no visible change to a toggle when pressed (but it does trigger conditional fields, value is saved, etc)": "https://www.drupal.org/files/issues/2024-08-06/3455558-Refactor-toggle-styles-mr438.patch"
},
"drupal/autosave_form": {
"Issue #3487459: Deprecation error on user edit form": "https://git.drupalcode.org/project/autosave_form/-/merge_requests/19.diff"
}
}
},
Expand All @@ -55,7 +58,7 @@
"drupal/access_unpublished": "^1.5",
"drupal/admin_toolbar": "^3.4",
"drupal/autofill": "^1.1",
"drupal/autosave_form": "^1.6",
"drupal/autosave_form": "1.7",
"drupal/blazy": "^2.14",
"drupal/checklistapi": "^2.1",
"drupal/core-recommended": "~10.3.0@stable",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ extend type Query {
channel(uuid: String!): Channel
user(uuid: String!): User
page(path: String!): Page
node(uuid: String!): Page
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ protected function resolveFields(): void {
$this->fromRoute($this->builder->fromArgument('path'))
);

$this->resolvePageInterfaceQueryFields('node', 'node');

// Teaser.
$this->addSimpleCallbackFields('Teaser', ['image', 'text']);

Expand Down
51 changes: 51 additions & 0 deletions modules/thunder_gqls/tests/examples/node.query.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
query ($uuid: String!) {
node(uuid: $uuid) {
uuid
url
name
entity
language
entityLinks {
canonical
}
... on Article {
published
author {
uuid
name
mail
entity
language
}
channel {
uuid
published
name
url
parent {
name
id
url
}
}
tags {
uuid
name
url
}
seoTitle
content {
__typename
}
teaser {
text
image {
uuid
derivative(style: "medium") {
width
}
}
}
}
}
}
69 changes: 69 additions & 0 deletions modules/thunder_gqls/tests/examples/node.response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"data": {
"node": {
"uuid": "36b2e2b2-3df0-43eb-a282-d792b0999c07",
"url": "/come-drupalcon-new-orleans",
"name": "Come to DrupalCon New Orleans",
"entity": "node",
"language": "en",
"entityLinks": {
"canonical": "/come-drupalcon-new-orleans"
},
"published": true,
"author": {
"uuid": "be8e7a25-8a41-4bda-a854-b4b9bb1b0a02",
"name": "test-seo",
"mail": null,
"entity": "user",
"language": "en"
},
"channel": {
"uuid": "0bb70443-8172-4d8e-9335-2876bc32e356",
"published": true,
"name": "Events",
"url": "/events",
"parent": null
},
"tags": [
{
"uuid": "35bdba6e-9b45-472a-8fda-11e7e69de71b",
"name": "Drupal",
"url": "/drupal"
}
],
"seoTitle": "Come to DrupalCon New Orleans",
"content": [
{
"__typename": "ParagraphGallery"
},
{
"__typename": "ParagraphText"
},
{
"__typename": "ParagraphTwitter"
},
{
"__typename": "ParagraphLink"
},
{
"__typename": "ParagraphQuote"
},
{
"__typename": "ParagraphVideo"
},
{
"__typename": "ParagraphPinterest"
}
],
"teaser": {
"text": "The Drupal community is one of the largest open source communities in the world. We're developers, designers, strategists, coordinators, editors, translators, and more. Each year, we meet at DrupalCamps, meetups, and other events in more than 200 countries. But once a year, our community comes together at the biggest Drupal event in the world: DrupalCon North America. This year, from May 9-13, we'll be in New Orleans.",
"image": {
"uuid": "a4c1035a-5b27-4713-8ba3-40ba5942486d",
"derivative": {
"width": 220
}
}
}
}
}
}
3 changes: 3 additions & 0 deletions modules/thunder_gqls/tests/examples/node.variables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"uuid": "36b2e2b2-3df0-43eb-a282-d792b0999c07"
}
Loading