Skip to content

Missing CodeRegistry provider in Osgi servlet #207

@cmaobeehive

Description

@cmaobeehive

Issue

As the typeResolver is deprecated in GraphQLInterfaceType, this piece of information is now moved to the typeResolverMap in GraphQLCodeRegistry which is currently not possible to provide to the OsgiGraphQLHttpServlet. Currently only following providers are available to provide data to build the GraphQL schema :

  • GraphQLQueryProvider
  • GraphQLMutationProvider
  • GraphQLSubscriptionProvider
  • GraphQLTypesProvider

As a result, you will see the following error when the typeResolver is not provided in the GraphQLInterfaceType :

The bindTypesProvider method has thrown an exception (graphql.AssertException: There must be a type resolver for interface Banner)
graphql.AssertException: There must be a type resolver for interface Banner
	at graphql.Assert.assertNotNull(Assert.java:15)
	at graphql.schema.GraphQLCodeRegistry.getTypeResolverForInterface(GraphQLCodeRegistry.java:117)
	at graphql.schema.GraphQLCodeRegistry.access$700(GraphQLCodeRegistry.java:28)
	at graphql.schema.GraphQLCodeRegistry$Builder.getTypeResolver(GraphQLCodeRegistry.java:208)
	at graphql.schema.CodeRegistryVisitor.visitGraphQLInterfaceType(CodeRegistryVisitor.java:40)
	at graphql.schema.GraphQLInterfaceType.accept(GraphQLInterfaceType.java:153)
	at graphql.schema.TypeTraverser$TraverserDelegateVisitor.enter(TypeTraverser.java:71)
	at graphql.util.Traverser.traverse(Traverser.java:144)
	at graphql.schema.TypeTraverser.doTraverse(TypeTraverser.java:58)
	at graphql.schema.TypeTraverser.depthFirst(TypeTraverser.java:50)
	at graphql.schema.TypeTraverser.depthFirst(TypeTraverser.java:38)
	at graphql.schema.SchemaUtil.extractCodeFromTypes(SchemaUtil.java:112)
	at graphql.schema.GraphQLSchema$Builder.lambda$build$1(GraphQLSchema.java:413)
	at graphql.schema.GraphQLCodeRegistry.transform(GraphQLCodeRegistry.java:139)
	at graphql.schema.GraphQLSchema$Builder.build(GraphQLSchema.java:413)
	at graphql.servlet.OsgiGraphQLHttpServlet.doUpdateSchema(OsgiGraphQLHttpServlet.java:176)
	at graphql.servlet.OsgiGraphQLHttpServlet.updateSchema(OsgiGraphQLHttpServlet.java:114)
	at graphql.servlet.OsgiGraphQLHttpServlet.bindTypesProvider(OsgiGraphQLHttpServlet.java:250)
	...

Solution

Add a GraphQLCodeRegistryProvider as a new GraphQLProvider and provide the codeRegistry to the builder of GraphQL schema

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions