Problem/Motivation
The GraphQL Compose documentation encourages using GraphQL's built-in schema extensions to extend the schema which is great because it teaches people skills that transfer to other places using GraphQL!
However, for its internal use the GraphQL Compose module contains its own SdlSchemaExtensionPluginBase class which mutes an error about the file naming of .graphqls
files which is a very helpful error message for developers new to GraphQL and prevents developers from getting stuck on a common challenge ("How do I name things?").
Developers who want to get started with GraphQL using the GraphQL Compose module are likely not to have a lot of knowledge about the GraphQL module itself and will instead choose classes from the GraphQL Compose module if they're presented with a choice. In this case that puts them on the back-foot.
The SdlSchemaExtensionPluginBase
class for the GraphQL Compose module is used by a lot of its submodules because all they try to do is to add resolvers without providing any schema (which is provided in a different way). This makes it a confusing class for people who are following the instructions to try and develop a GraphQL schema extension (since they no longer get any error messages for incorrectly named schemas).
Steps to reproduce
Proposed resolution
Deprecate the SdlSchemaExtensionPluginBase
class in the GraphQL Compose module. This ensures that people who want to create a GraphQL Schema Extension on top of the GraphQL Compose module use the class included in the GraphQL module itself.
Replace the class with a class named ResolverOnlySchemaExtensionPluginBase
to more clearly define its role within the graphql_compose module. Within that class, instead of muting the error from loadDefinitionFile
, overwrite getBaseDefinition
and getExtensionDefinition
to return NULL
which aids in showing that the intent is not to provide any schema here.
Optionally mark the class as @internal
if its not intended as a jumping off point for other developers, although with the new naming and implementation that purpose may be clearer and is not needed.
Remaining tasks
User interface changes
API changes
Data model changes