close

Filter

loading table of contents...

Headless Server Developer Manual / Version 2207

Table Of Contents

5.2 Using RichTextAdapters for Different Rich Text Grammars

The Headless Server comes with an architecture to parse different flavors of rich text, including an out of the box RichTextAdapter to parse and transform the well known CoreMedia rich text grammar. The architecture allows customizing both, the grammar to be parsed and the underlying parsing technology, using standard Spring Boot beans.

The content repository delivers rich text as objects of type Markup, whereas the content schema declares a custom scalar type RichTextTree on all fields of the type Markup. The underlying architecture of graphql-java requires registering an implementation of the Coercing interface for a declared custom scalar type (RichTextTree). This is done in the config class CaasConfig by adding the scalar type and its conversion type Map and creating a bean of type GraphQLScalarType, which takes the Coercing implementation. By doing this, graphql-java now always expects a Map<String,Object> object when resolving fields of the scalar type RichTextTree.

With this kind of registration, only one Coercing class per scalar is possible. To overcome this limitation, CoreMedia has added a mechanism to invoke custom classes to handle different grammar types and to use any type of parsing/transformation technology.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

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