Skip to content

Commit a6a210c

Browse files
authored
CIF-2658 - Automate pruned schema generation with CLI tool (#164)
* releng - Update CIF Add-on UI Schemas * releng - Update CIF Add-on Queries * releng - Update CIF Core Components Queries * CIF - Automate pruned schema generation with CLI tool * CIF-2658 - Add feedback * CIF-2658 - Fix unit test
1 parent ef5bc2f commit a6a210c

23 files changed

+92249
-12723
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,9 @@ In order to illustrate these requirements, the `localSchema()` function in [disp
148148

149149
## Schema documentation
150150

151-
As stated in the previous section, GraphQL introspection allows users to discover and browse a GraphQL schema in order to understand the types of queries it supports. When implementing a 3rd-party integration and because the Magento schema is large, it is important that one understands the parts of the Magento schema that are actually used by the CIF connector and components. To document this, we have implemented a tool that uses the GraphQL queries used by the CIF connector and components in order to create the subset of the Magento schema that MUST be implemented in order to support the CIF connector and components.
151+
As stated in the previous section, GraphQL introspection allows users to discover and browse a GraphQL schema in order to understand the types of queries it supports. When implementing a 3rd-party integration and because the Magento schema is large, it is important that one understands the parts of the Magento schema that are actually used by the CIF add-on and core components. To document this, we have implemented a tool that uses the GraphQL queries used by the CIF add-on and components in order to create the subset of the Magento schema that MUST be implemented in order to support the CIF add-on and components.
152152

153-
This "pruned" schema is automatically generated and included in this repository. If needed, one can regenerate it by running `npm run doc`. Note that this requires that you have the [jq](https://github.com/stedolan/jq) tool installed on your machine.
153+
To generate a "pruned" schema, please check the [schemas](schemas/README.md) folder.
154154

155155
To introspect this schema, it is automatically deployed when running `aio app deploy` in a web action called `cif-schema`. Using a GraphQL introspection tool like the included `GraphiQL`, one can then easily browse the pruned schema at the `https://adobeioruntime.net/api/v1/web/NAMESPACE/graphql-reference/cif-schema` URL. This action only supports introspection, so you cannot execute any query. It however documents all the fields and types that are currently being used by the CIF connector and components.
156156

actions/common/SchemaBuilder.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class SchemaBuilder {
4040
}
4141

4242
// Remove "Mutation" root type if it doesn't have any field
43-
if (mutationRootType && mutationRootType.fields.length == 0) {
43+
if (!mutationRootType || (mutationRootType && mutationRootType.fields.length == 0)) {
4444
this.removeMutationType();
4545
}
4646

actions/documentation/generate.js

Lines changed: 0 additions & 85 deletions
This file was deleted.

actions/documentation/introspection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
'use strict';
1616

17-
const magentoSchema = require('../resources/magento-schema-2.4.3ee.pruned.min.json');
17+
const magentoSchema = require('../resources/pruned-schema.min.json');
1818
const { buildClientSchema, graphql } = require('graphql');
1919

2020
function resolve(args) {

0 commit comments

Comments
 (0)