Updating a GraphQL Schema

The Cook needs a GraphQL schema describing the structure of the content it has access to – that is, the structure of the publication. The DPRES demo includes a schema for the demo publication in its schema folder. If you want to create a presentation layer for your own publication, then the first step is to replace these files with files that describe your publication.

A shell script for generating new schema files based on any Escenic publication is included in the demo. In order to use the script you must have access to the publication you want to work with. In the dpres-demo folder, enter:

./update-schema.sh publication-name user:password http://mytestengine.com:8080/webservice/

The script's three parameters are:

  • The name of the publication

  • Credentials for accessing the publication

  • The URL of the Content Engine's webservice. The URL must be terminated with a /.

The update-schema.sh script sends a series of requests to the specified web service, and retrieves the information it needs to generate a complete description of the publication structure in the form of Javascript schema files. It writes these files to the DPRES demo's schema folder. You will see that it generates an index.js for section pages, one .js file for each content type defined in the publication's content-type resource and one .js file for each group defined in the publication's layout-group resource.