close

Filter

loading table of contents...

CoreMedia Content Cloud v12 Upgrade Guide / Version 2404

Table Of Contents

7.10.3 Schema Loading API Change

The GraphQL schema loading used to work by path patterns. To be more flexible regarding the ability to enable or disable a feature which may come with a supplementary schema fragment, all schema fragments delivered out of the box now come as regular Spring Beans with the annotation @Qualifier(“graphqlSchemaResource”).

All Spring Beans of the type org.springframework.core.io.Resource with that qualifier are automatically collected and added to the resulting schema.

Deployments consisting of custom extensions with a schema fragment must update their implementation to detect the schema extension.

Example Code Snippet:

@Bean
@Qualifier("graphqlSchemaResource")
public Resource mySchemaResource() throws IOException {
  PathMatchingResourcePatternResolver loader = new PathMatchingResourcePatternResolver();
  return Arrays.stream(loader.getResources("classpath*:graphql/my-path/my-schema-extension.graphql"))
          .findFirst()
          .orElseThrow(() -> new IOException("GraphQl schema resource graphql/my-path/my-schema-extension.graphql' not found."));
}

Note, that the pattern-based detection of GraphQL schema files also still works. The Spring-GraphQL library detects by default all schema files on the class path with the file type-extension .graphqls.

Search Results

Table Of Contents
warning

Your Internet Explorer is no longer supported.

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