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-whiteboard.git
The following commit(s) were added to refs/heads/master by this push:
new 6e37a49 GraphQL schema module spec
new 49b228b Merge branch 'master' of github.com:apache/sling-whiteboard
6e37a49 is described below
commit 6e37a49ef1edd57b52bbb1fd7ac8202ae9015953
Author: Bertrand Delacretaz <[email protected]>
AuthorDate: Fri Jun 25 10:57:57 2021 +0200
GraphQL schema module spec
---
sling-org-apache-sling-graphql-schema/.asf.yaml | 7 ++
sling-org-apache-sling-graphql-schema/.gitignore | 12 +++
.../CODE_OF_CONDUCT.md | 22 ++++++
.../CONTRIBUTING.md | 24 ++++++
sling-org-apache-sling-graphql-schema/Jenkinsfile | 20 +++++
sling-org-apache-sling-graphql-schema/README.md | 88 ++++++++++++++++++++++
sling-org-apache-sling-graphql-schema/bnd.bnd | 1 +
7 files changed, 174 insertions(+)
diff --git a/sling-org-apache-sling-graphql-schema/.asf.yaml
b/sling-org-apache-sling-graphql-schema/.asf.yaml
new file mode 100644
index 0000000..6308520
--- /dev/null
+++ b/sling-org-apache-sling-graphql-schema/.asf.yaml
@@ -0,0 +1,7 @@
+github:
+ description: "Apache Sling GraphQL Schema"
+ homepage: "https://sling.apache.org/"
+ labels:
+ - sling
+ - java
+ - graphql
diff --git a/sling-org-apache-sling-graphql-schema/.gitignore
b/sling-org-apache-sling-graphql-schema/.gitignore
new file mode 100644
index 0000000..08082a5
--- /dev/null
+++ b/sling-org-apache-sling-graphql-schema/.gitignore
@@ -0,0 +1,12 @@
+.project
+.classpath
+.settings
+target
+bin
+*.iml
+.idea
+.DS_Store
+dependency-reduced-pom.xml
+.vscode
+node_modules
+openwhisk_action.zip
diff --git a/sling-org-apache-sling-graphql-schema/CODE_OF_CONDUCT.md
b/sling-org-apache-sling-graphql-schema/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..0fa18e5
--- /dev/null
+++ b/sling-org-apache-sling-graphql-schema/CODE_OF_CONDUCT.md
@@ -0,0 +1,22 @@
+<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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.
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+Apache Software Foundation Code of Conduct
+====
+
+Being an Apache project, Apache Sling adheres to the Apache Software
Foundation's [Code of
Conduct](https://www.apache.org/foundation/policies/conduct.html).
diff --git a/sling-org-apache-sling-graphql-schema/CONTRIBUTING.md
b/sling-org-apache-sling-graphql-schema/CONTRIBUTING.md
new file mode 100644
index 0000000..ac82a1a
--- /dev/null
+++ b/sling-org-apache-sling-graphql-schema/CONTRIBUTING.md
@@ -0,0 +1,24 @@
+<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ 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.
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+Contributing
+====
+
+Thanks for choosing to contribute!
+
+You will find all the necessary details about how you can do this at
https://sling.apache.org/contributing.html.
diff --git a/sling-org-apache-sling-graphql-schema/Jenkinsfile
b/sling-org-apache-sling-graphql-schema/Jenkinsfile
new file mode 100644
index 0000000..f582519
--- /dev/null
+++ b/sling-org-apache-sling-graphql-schema/Jenkinsfile
@@ -0,0 +1,20 @@
+/**
+ * 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.
+ */
+
+slingOsgiBundleBuild()
diff --git a/sling-org-apache-sling-graphql-schema/README.md
b/sling-org-apache-sling-graphql-schema/README.md
new file mode 100644
index 0000000..5b59a20
--- /dev/null
+++ b/sling-org-apache-sling-graphql-schema/README.md
@@ -0,0 +1,88 @@
+[](https://sling.apache.org)
+
+Apache Sling GraphQL Schema
+----
+
+This module provides services to combine partial GraphQL schema ("partials")
supplied by
+_provider bundles_.
+
+The partials are text files that use the GraphQL SDL (Schema Definition
Language) syntax and are
+provided as OSGi bundle resources. We cannot name them "fragments" as that has
a different meaning
+in a GraphQL schema.
+
+A GraphQL schema must contain one `Query` statement and can contain a most one
`Mutation` statement,
+so partials cannot be assembled by just concatenating them. The schema
assembler defines some simple
+rules for how to write the partials so that they can be aggregated efficiently.
+
+This module also provides a `GraphQLSchemaServlet` that generates schemas by
aggregating partials.
+The result can be used directly by the Sling GraphQL Core module, which makes
an internal Sling request
+to get the schema. Multiple instances of that servlet can be configured, each
with specific servlet
+selection properties (selectors, extension etc.) along with a set of tags used
to select which partials
+are included in a specific schema.
+
+With this mechanism, an OSGi bundle can provide both a partial schema and the
Sling data fetching and
+processing services that go with it. This allows a GraphQL "API plane"
(usually defined by a specific
+instance of the Sling `GraphQLServlet`) to be built out of several OSGi
bundles which each focus on a
+specific set of queries, mutations and types.
+
+## Provider bundles
+
+To provide partials, a bundle sets a `Sling-GraphQL-Schema` header in its OSGi
manifest, with a value that
+points to one or several paths where partials are found.
+
+A partial is a text file with a `.graphql.partial.txt` extension that has the
following structure:
+
+ # The "org.apache.sling.*" comments in the partial are used by the schema
assembler, which might
+ # impose constraints on their presence and values.
+ #
+ # org.apache.sling.partial.name: Folders and commands
+ # org.apache.sling.tags: folder, command, development, authoring
+ #
+ # The aggregated schema will include additional org.apache.sling.*
comments to provide information
+ # on the aggregation process and help troubleshoot it.
+
+ # If a partial contains a Query and/or Mutation statement, the schema
assembler uses their
+ # indentation to parse them without having to consider the full SDL syntax.
+ #
+ # These Query and Mutation keywords, along with their closing bracket,
MUST NOT be indented,
+ # and everything inside them MUST be indented by at least one whitespace
character.
+
+ type Query {
+ """
+ Query a single Folder.
+ If not specified, the path defaults to the Resource which receives the
query request.
+ """
+ folder(path: String) : Folder @fetcher(name:"samples/folder")
+ }
+
+ type Mutation {
+ """
+ 'lang' is the command language
+ 'script' is the script to execute, in the language indicated by 'lang'
+ """
+ command(lang: String, input: Object) : CommandResult
@fetcher(name:"samples/command")
+ }
+
+ # There are no constaints on the rest of the schema, which the assembler
simply concatenates
+ # after the Query and Mutation sections
+ type Folder {
+ path : ID!
+ }
+
+## Implementation notes
+
+TODO remove those once the module is implemented.
+
+We can use an [OSGi Extender
Pattern](https://enroute.osgi.org/FAQ/400-patterns.html) to handle the
+provider bundles, similar to what we do for
+[initial content
loading|https://sling.apache.org/documentation/bundles/content-loading-jcr-contentloader.html]
+.
+
+The assembler bundle can use a
+[BundleTracker](https://docs.osgi.org/javadoc/r4v42/org/osgi/util/tracker/BundleTracker.html)
+to detect the provider bundles based on their manifest header.
+
+It can use logic similar to the jcr content loader module to load the partial
schema text files:
+
+*
https://github.com/apache/sling-org-apache-sling-jcr-contentloader/blob/master/src/main/java/org/apache/sling/jcr/contentloader/PathEntry.java
+* Bundle.getEntryPaths to enumerate file resources in the bundle
\ No newline at end of file
diff --git a/sling-org-apache-sling-graphql-schema/bnd.bnd
b/sling-org-apache-sling-graphql-schema/bnd.bnd
new file mode 100644
index 0000000..d1c6fc4
--- /dev/null
+++ b/sling-org-apache-sling-graphql-schema/bnd.bnd
@@ -0,0 +1 @@
+# nothing so far
\ No newline at end of file