feat: #3586928 Split resolver registry init, build, and retrieve

SdlSchemaPluginBase expected downstream classes to provide the resolver registry and then passed it around. This makes it difficult to properly cache it.

In this commit the SdlSchemaPluginBase class takes ownership of getResolverRegistry as public method to get the registry (currently used in Server, but in the future perhaps not publicly needed) and then splits out the internal steps to build the registry into separately overridable features.

By default we now instantiate the ResolverRegistry from the GraphQL module, providing room for this class to be overwritten. The actual registration of resolvers is split out to two separate functions: registerResolvers, which should now be implemented by downstream schema plugins just like in extensions, and registerExtensionResolvers, which contains the extension registration and should generally not need to be overwritten.

In the future if there are no resolvers in the registry which prevent serialization, then we can provide opt-in to registry caching as part of getResolverRegistry without any additional API breaks. The shape of that method can be similar to getSchemaDocument where we either fetch from the cache, or call out to the separate functions to build before storing in the cache.

Closes #3586928

Merge request reports

Loading