close

Filter

loading table of contents...

Headless Server Developer Manual / Version 2307

Table Of Contents

9.1.2 Defining Persisted Query Maps in Apollo Format

The Apollo client tool extracts GraphQL queries from your client code and generates a JSON file in the following form:

{
  "version": 2,
  "operations": [
    {
      "signature": "88a2611edf717d47e91712e57f652aed0efb8ffa3190466aa05ce448468203c5",
      "document": "query ArticleQuery(....) {...}}",
      ...
    }, {
      "signature": "64cff55bc1c8bfc2e6f8522aa4481bebee33eb7f1d9d9a3c8af12fc2e2aa2a9b",
      "document": "query PageQuery(....) {...}}",
      ...
    },
    ...
  ]
}

This JSON file can then be used by your client and the Headless Server for query whitelisting (see Section 9.2, “Query Whitelisting”).

For the Headless Server, the JSON file must be accessible at server startup time as a resource resolvable by a Spring PathMatchingResourcePatternResolver. One way to do this is to transfer the JSON file to the Headless Server workspace for inclusion at build time as a Java resource file.

By default, the Headless Server looks for Apollo query maps at locations specified by the configuration property caas.persisted-queries.apollo-query-map-resources-pattern, which defaults to classpath:graphql/queries/apollo*.json.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

Please use Mozilla Firefox, Google Chrome, or Microsoft Edge.