Skip to content

Improve support for GraphQLSchema transformation #536

Closed
@rstoyanchev

Description

@rstoyanchev

The question on generating parts of a schema and runtime wiring dynamically comes up often, see #452 and #532 for example, and that can be done by applying a GraphQLTypeVisitor through a SchemaTransformer.

It is possible to register one or more GraphQLTypeVisitor via GraphQlSource.Builder, but those are applied with SchemaTraverser, which allows only schema traversal (and code registry changes), but not schema changes. That covers a lot of use cases (all of the Spring for GraphQL ones), in a more performance manner. To actually transform the schema with a visitor, one needs to register a schemaFactory instead via GraphQlSource.Builder, but that involves also actually creating the GraphQLSchema, which is not relevant for the transformation.

It would be more convenient to be able to register GraphQLTypeVisitor that should be applied with SchemaTransformer instead of with SchemaTraverser. Perhaps an overloaded typeVisitorsForTransformation method on the GraphQlSource.Builder.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions