Headless Server Developer Manual / Version 2110
Table Of ContentsIn GraphQL, Objects may contain cross references (relations, "links") to other objects:
Typically, a special field holds some kind of identifier or ID of this object, and other objects refer to it with the value of this ID.
Another kind of reference is a hyperlink, for example the URL of some binary resource.
The CoreMedia Headless Server supports both types of references by a unified Link Composing API. This API is a generalization of the CAE link schemes and post processors (see Section 4.3.2.2, “Writing Link Schemes” in Content Application Developer Manual and Section 4.3.2.3, “Post Processing Links” in Content Application Developer Manual).
A LinkComposer is a PartialFunction from some domain object type to a resulting link type.
All link composers are partial functions: if they are not able to map an object to a proper link of the given target type,
they return an empty Optional
. If no configured link composer returns a non-empty Optional
,
the GraphQL query response will contain a null
value for the link.