Use schema directives as per GraphQL core module changes
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 @@
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 @@
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/directives.jsp b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/directives.jsp
new file mode 100644
index 0000000..368398d
--- /dev/null
+++ b/org.apache.sling.graphql.samples.website/src/main/resources/SLING-INF/initial-content/apps/samples/common/directives.jsp
@@ -0,0 +1,25 @@
+<%--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+--%>
+
+# 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" %>
}