graphql-java extension type redefine error from version 15

22 views Asked by At

I'm encountering an issue after upgrading from graphql-java 14 to version 15 or higher in my GraphQL router project. Prior to the upgrade, I had remote-schema JSON files for each module, and I used classes to stitch these schemas together to generate the GraphqlSchema class. Everything was functioning correctly with graphql-java 14, but upon upgrading to version 15 or above, I'm facing the following problem:

During application startup, I'm receiving the error message: 'Query' extension type [@-1:-1] tried to redefine field 'getUser'. Interestingly, if I remove the getUser type from the remote schema JSON files of Module 2 and 3, the application starts without issues. However, this results in queries related to getUser in Module 2 and 3 not functioning as expected.

Below is a simplified representation of the structure:

Module 1 Schema:

graphql

schema {
    query: Query
    mutation: Mutation
}

type Query {
    getUser(email: String!): PUser! @auth
}

type PUser {
    isUser: Boolean!  
    permissions: [String]!
}

Module 2 Schema:

graphql

type PUser {
    module2: Module2
}

extend type Query {
    getUser (email: String!) : PUser! 
}

type Module2{
    status: USER_ONBOARDING_STATUS!
}

Module 3 Schema:

graphql

type PUser {
    module3: Module3
}

extend type Query {
    getUser (email: String!) : PUser! 
}

type Module3 {
    status: USER_ONBOARDING_STATUS!
}

Sample Query:

graphql

query getPUser($email: String!) {
    getUser(email: $email) {
        isUser
        module2 {
            status
        }
        module3 {
            status
        }
    }
}
0

There are 0 answers