close

Filter

loading table of contents...

CoreMedia Content Cloud v12 Upgrade Guide / Version 2404

Table Of Contents

7.10.4 Query Root Extension

If you extend not only existing GraphQL types from the content schema but also the query root type itself, the binding between the HTTP transport tier and the schema must be implemented by a Spring controller class containing a method named like the new query root property. The method should deliver your original root object.

Example:
# GraphQL-Schema extension:
    extend type Query {
    customRoot: CustomRoot
    }

    type CustomRoot {
    types: [CustomType]
    }

    type CustomType {
    name: String
    }

    ------------------------

    // Java class
    @Controller
    public class CustomRootController {

    private final CustomRoot customRoot;

    public CustomRootController (CustomRoot customRoot) {
    this.customRoot = customRoot;
    }

    @QueryMapping
    public CustomRoot customProperty() {
    return customRoot;
    }
    }

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

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