Headless Server Developer Manual / Version 2307
Table Of ContentsTo integrate PDE (preview driven editing) functionality to a client, a mapping from the field name in the GraphQL schema to the content type property is required. This mapping is defined on the Headless Server and delivered via MetadataProvider as metadata on fields.
Configuration
The field to property name mapping is configured in file(s) at a configurable location (classpath*:graphql/metadata/propertyMapping*.json
)
as part of Blueprint with a configurable default filename (propertyMapping.json
), see
Section 3.3.3, “Metadata Properties” in Deployment Manual for details.
To add a new custom property mapping file definition, either change the location or the default filename and add the custom property mapping file definition accordingly.
To merge the default property mapping with a custom mapping, add a custom file to the default location and choose
a name that matches the given pattern but is different from the default filename, for example,
propertyMapping-custom.json
.
The default file is then loaded first, so that subsequent files can override the values.
The entries in the property mapping file consist of interface types that wrap the mapping of field name to the content type property name.
Property mapping configuration (propertyMapping.json):
{ "CMCollection": { "teasableItems": "properties.items", "bannerItems": "properties.items", "detailItems": "properties.items" }, ...
The configured mapping applies also to types that implement the interface.
Configuration is only required for fields whose name differs from the content type property name and for implied content properties.
The default mapping for fields is "<fieldname>": "properties.<fieldname>"
.
Implied content properties like id
, type
etc. are suffixed with "_" and need to be
configured explicitly in the mapping file. A default configuration is provided in propertyMapping.json
.
The response of a metadata request containing PDE mapping looks like:
{ "data": { "metadata": { "types": [ { "name": "CMCollectionImpl", "fields": [ { "name": "id", "metadata": { "mapping": "id_" } }, { "name": "teasableItems", "metadata": { "mapping": "properties.items" } }, ... } ] } }
Scope
PDE mapping metadata is provided for ObjectTypeDefinitions that implement an interface, for example
CMArticleImpl
. The restriction is applied, because the PDE field mapping is not required for root
types and custom object types. The mapping is also not available for InterfaceTypDefinitions, for example CMArticle
.
The MetadataProvider for PDE Mapping is configured for preview only, as PDE is only available in preview apps and typically used to preview data in Studio.