Skip to content
This repository has been archived by the owner on May 6, 2023. It is now read-only.

Latest commit

 

History

History
96 lines (70 loc) · 5.17 KB

File metadata and controls

96 lines (70 loc) · 5.17 KB

Schema Configuration

A schema configuration is used by the Single Endpoint, Custom Endpoints and Persisted Queries to customize their behavior.

Description

The GraphQL schema can be configured with those elements provided by the different installed and enabled modules. (Go to the "Modules" page to see the list of all of them.)

Each module can define its configuration through its own block in the Schema Configuration editor. This includes blocks for:

  • Setting the schema as public or private
  • Enabling “sensitive” data elements
  • Namespacing the schema
  • Using nested mutations
  • Define who can access the schema via Access Control Lists
  • Set-up HTTP caching via Cache Control Lists
  • Many others

Schema Configuration

Creating a Schema Configuration

Clicking on the Schema Configurations link in the menu, it displays the list of all of them:

Schema Configurations in the admin

A schema configuration is a custom post type (CPT). To create a new schema configuration, click on button "Add New Schema Configuration", which will open the WordPress editor:

Creating a new Schema Configuration

We can optionally remove those configuration blocks which use the corresponding "Default" value from the Settings. The removed block can be added once again via the inserter menu, by clicking on the + button at the bottom (please notice that only one instance of each block can be inserted):

Removing and adding blocks in the Schema Configuration

To configure the different elements in the schema configuration, click on corresponding input, and it becomes editable. Then select the entries that apply to the configuration. When you are done, click on "Publish":

Creating a new Schema Configuration

Once published, the schema configuration becomes available when editing a Custom Endpoint or Persisted Query:

Selecting the Schema Configuration in the Custom Endpoint

If the Custom Endpoint or Persisted Query has value "Default", then the schema configuration selected in the Settings will be used:

Default Schema Configuration in the Settings

Opening the schema configuration's permalink in the browser will show its contents (as long as the user is logged-in and the user role has access to it):

Schema configuration's source

Editor Inputs

These inputs in the body of the editor are shipped with the plugin (more inputs can be added by extensions):

Input Description
Expose Sensitive Data in the Schema Expose “sensitive” data elements in the GraphQL schema (such as field Root.roles, field arg Root.posts(status:), and others), which provide access to potentially private user data. If "Default" is selected, the value selected in the Settings is used.
Mutation SchemeDefine if to enable mutations, and if the redundant fields from the root must be removed. If "Default" is selected, the value selected in the Settings is used.
Namespace Types?Define if to have all types in the schema automatically namespaced. If "Default" is selected, the value selected in the Settings is used.
Access Control Lists (If module Access Control is enabled) Manage who can access the schema, by selecting the Access Control Lists that must be applied to the custom endpoint or persisted query
Public/Private Schema (If module Public/Private Schema is enabled) When access to some a field or directive is denied, there are 2 ways for the API to behave:
  • "Public": Provide an error message to the user, indicating why access is denied. This behavior makes the metadata from the schema always available.
  • "Private": The error message indicates that the field or directive does not exist. This behavior exposes the metadata from the schema only to those users who can access it.
If "Default" is selected, the value selected in the Settings is used.
Cache Control Lists (If module Cache Control is enabled) Manage the behavior of HTTP caching, by selecting the Cache Control Lists that must be applied to the custom endpoint or persisted query
Many others (Check the corresponding enabled modules...)

These are the inputs in the Document settings:

Input Description
Excerpt Provide a description for the schema configuration.
This input is available when module Excerpt as Description is enabled