Skip to content

Reusing the same TypeReference instance breaks reference resolution in the current master #1216

@kaqqao

Description

@kaqqao

There's a difference in the type reference resolution logic between 10.0 release and the current master.
If the exact same TypeReference instances is used in multiple places, it will not work correctly in master.

GraphQLTypeReference ref = new GraphQLTypeReference("String");

GraphQLSchema schema = GraphQLSchema.newSchema()
                .query(GraphQLObjectType.newObject()
                        .name("Query")
                        .field(GraphQLFieldDefinition.newFieldDefinition()
                                .name("test")
                                .type(Scalars.GraphQLString)
                                .argument(GraphQLArgument.newArgument()
                                        .name("in")
                                        .type(GraphQLInputObjectType.newInputObject()
                                                .name("ObjInput")
                                                .field(GraphQLInputObjectField.newInputObjectField()
                                                        .name("value")
                                                        .type(ref)) //Will get replaced, as expected
                                                .field(GraphQLInputObjectField.newInputObjectField()
                                                        .name("value2")
                                                        .type(ref)) //Will *not* get replaced the 2nd time it's used
                                                .build())
                                )
                                .dataFetcher(env -> "test")
                        )
                )
                .build();

I'm guessing it gets marked as visited the first time, so it won't get checked again.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions