This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-samples.git

commit 40c90c1eac335c7738031be91761b131f06da3f1
Author: Bertrand Delacretaz <[email protected]>
AuthorDate: Wed Jun 3 14:02:19 2020 +0200

    Use schema directives as per GraphQL core module changes
---
 .../initial-content/apps/samples/article/GQLschema.jsp        |  6 +++---
 .../initial-content/apps/samples/common/GQLschema.jsp         | 11 +++++------
 .../apps/samples/common/common-query-parts.jsp                |  3 +--
 .../samples/common/{common-query-parts.jsp => directives.jsp} |  8 ++++++--
 .../initial-content/apps/samples/section/GQLschema.jsp        |  6 +++---
 .../initial-content/apps/samples/servlet/GQLschema.jsp        |  6 +++---
 .../SLING-INF/initial-content/apps/samples/tag/GQLschema.jsp  |  6 +++---
 7 files changed, 24 insertions(+), 22 deletions(-)

diff --git 
a/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/article/GQLschema.jsp
 
b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/article/GQLschema.jsp
index 4623eb3..446d209 100644
--- 
a/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/article/GQLschema.jsp
+++ 
b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/article/GQLschema.jsp
@@ -17,11 +17,11 @@
 * under the License.
 --%>
 
+<%@include file="../common/directives.jsp" %>
+
 type Query {
-  ## fetch:samples/currentResource
-  #
   # The current Article
-  article : Article
+  article : Article @fetcher(name:"samples/currentResource")
 
   <%@include file="../common/common-query-parts.jsp" %>
 }
diff --git 
a/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/GQLschema.jsp
 
b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/GQLschema.jsp
index 01ced46..abfeb49 100644
--- 
a/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/GQLschema.jsp
+++ 
b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/GQLschema.jsp
@@ -20,6 +20,9 @@
 # This is the common parts of our "samples" schemas
 # It is included (using JSP includes for now) in
 # the resourceType-specific schemas
+#
+# The directives.jsp schema fragment must be loaded
+# before this one.
 
 # Website navigation  information
 type Navigation {
@@ -38,10 +41,8 @@ type Section {
   name: String
   path: String
   
-  ## fetch:samples/articlesBySection
-  #
   # List of articles in this section
-  articles: [Article]
+  articles: [Article] @fetcher(name:"samples/articlesBySection")
 }
 
 # Articles are the core content of our website
@@ -52,10 +53,8 @@ type Article {
   tags: [String]
   text: String
 
-  ## fetch:samples/seeAlso
-  #
   # List of "See Also" articles
-  seeAlso: [Article]
+  seeAlso: [Article] @fetcher(name:"samples/seeAlso")
 }
 
 # A query for articles which have specific tags
diff --git 
a/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/common-query-parts.jsp
 
b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/common-query-parts.jsp
index 0cd833f..d050048 100644
--- 
a/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/common-query-parts.jsp
+++ 
b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/common-query-parts.jsp
@@ -17,5 +17,4 @@
 * under the License.
 --%>
 
-## fetch:samples/navigation
-navigation: Navigation
+navigation: Navigation @fetcher(name:"samples/navigation")
diff --git 
a/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/common-query-parts.jsp
 
b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/directives.jsp
similarity index 82%
copy from 
org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/common-query-parts.jsp
copy to 
org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/directives.jsp
index 0cd833f..368398d 100644
--- 
a/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/common-query-parts.jsp
+++ 
b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/directives.jsp
@@ -17,5 +17,9 @@
 * under the License.
 --%>
 
-## fetch:samples/navigation
-navigation: Navigation
+# This directive maps fields to our Sling data fetchers
+directive @fetcher(
+    name : String,
+    options : String = "",
+    source : String = ""
+) on FIELD_DEFINITION
\ No newline at end of file
diff --git 
a/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/section/GQLschema.jsp
 
b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/section/GQLschema.jsp
index a9dc531..17331b7 100644
--- 
a/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/section/GQLschema.jsp
+++ 
b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/section/GQLschema.jsp
@@ -17,11 +17,11 @@
 * under the License.
 --%>
 
+<%@include file="../common/directives.jsp" %>
+
 type Query {
-  ## fetch:samples/currentResource
-  #
   # The current content section
-  section: Section
+  section: Section @fetcher(name:"samples/currentResource")
 
   <%@include file="../common/common-query-parts.jsp" %>
 }
diff --git 
a/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/servlet/GQLschema.jsp
 
b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/servlet/GQLschema.jsp
index 1336e49..63514de 100644
--- 
a/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/servlet/GQLschema.jsp
+++ 
b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/servlet/GQLschema.jsp
@@ -17,11 +17,11 @@
 * under the License.
 --%>
 
+<%@include file="../common/directives.jsp" %>
+
 type Query {
-  ## fetch:samples/articlesWithText
-  #
   # List of Articles which contain the supplied text
-  article (withText : String) : [Article]
+  article (withText : String) : [Article] 
@fetcher(name:"samples/articlesWithText")
 }
 
 <%@include file="/apps/samples/common/GQLschema.jsp" %>
\ No newline at end of file
diff --git 
a/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/tag/GQLschema.jsp
 
b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/tag/GQLschema.jsp
index bcfc571..519afef 100644
--- 
a/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/tag/GQLschema.jsp
+++ 
b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/tag/GQLschema.jsp
@@ -17,12 +17,12 @@
 * under the License.
 --%>
 
+<%@include file="../common/directives.jsp" %>
+
 type Query {
-  ## fetch:samples/tagQuery
-  #
   # Find articles which have the current
   # set of tags
-  tagQuery: TagQuery
+  tagQuery: TagQuery @fetcher(name:"samples/tagQuery")
 
   <%@include file="../common/common-query-parts.jsp" %>
 }

Reply via email to