Skip to content

NPE in SchemaTransformer when used with interfaces #1953

Description

@davidcurrie

Describe the bug
Same NPE as described in #1928 but, in this case, just with the use of SchemaTransformer where a change is made to an interface and implementation rendering it unusable in our scenario.

java.lang.NullPointerException
	at graphql.util.FpKit.map(FpKit.java:139)
	at graphql.schema.SchemaTransformer.lambda$getDeepestZippers$1(SchemaTransformer.java:267)
	at java.util.stream.Collectors.lambda$groupingBy$45(Collectors.java:907)
	at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
	at java.util.Iterator.forEachRemaining(Iterator.java:116)
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
	at graphql.util.FpKit.groupingBy(FpKit.java:43)
	at graphql.schema.SchemaTransformer.getDeepestZippers(SchemaTransformer.java:265)
	at graphql.schema.SchemaTransformer.toRootNode(SchemaTransformer.java:207)
	at graphql.schema.SchemaTransformer.transform(SchemaTransformer.java:176)
	at graphql.schema.SchemaTransformer.transformSchema(SchemaTransformer.java:112)

To Reproduce
Test case here: https://gist.github.com/davidcurrie/685746b59cab96d68510deaa87caa411

Notably, the failure is dependent on the order of the fields in Query. If the interface is referenced first, it fails, if it is referenced second then it passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions