Skip to content

Failed validation for alias clashing with another field #3332

@martinbonnin

Description

@martinbonnin

The following test fails:

    @Test
    fun test() {
        val schemaString = """
            type Query {
                cat: Cat!
            }
            
            type Cat {
                foo1: String!
                foo2: String!
            }
        """.trimIndent()

        val documentString = """
            query GetCat {
              cat {
                foo1
                foo1: foo2
              }
            }

        """.trimIndent()
        val typeDefinitionRegistry = SchemaParser().parse(schemaString)
        val document = Parser().parseDocument(documentString)
        val graphQLSchema = SchemaGenerator().makeExecutableSchema(typeDefinitionRegistry, RuntimeWiring.newRuntimeWiring().build())
        val result = Validator().validateDocument(graphQLSchema, document, Locale.US)

        // There should be a validation error at this point.
        check(result.isNotEmpty())
    }

I would expect a validation error because foo1 and foo1: foo2 cannot be merged.

Edit: this is on version 21.1

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