graphql-schema_comparator icon indicating copy to clipboard operation
graphql-schema_comparator copied to clipboard

Extended Query being reported as a different to a non-extended Query, when it is actually the same.

Open andyce1010 opened this issue 3 years ago • 2 comments

When comparing a query where the expected type has been extended to exactly match the actual type, the comparator is currently reporting a change.

Can someone confirm if this is correct? I would have expected the two queries to show no changes.

Expected:

type Query {
}

extend type Query {
   test(id: String!): String!
}

Actual:

type Query {	
   test(id: String!): String!
}

Output: `⏳ Checking for changes... 🎉 Done! Result:

Detected the following changes between schemas:

✅ Field test was added to object type Query `

andyce1010 avatar Dec 13 '21 16:12 andyce1010

Just to confirm, are expected and actual the two schemas you're comparing?

I'd probably expect the diff between those to show no changes either. This might also be behaviour from the graphql-ruby gem itself. I'd suggest running GraphQL::Schema.from_definition(schema).to_definition to see what it outputs for the schema with extend

swalkinshaw avatar Dec 13 '21 16:12 swalkinshaw

Yes that's right.

Thanks, unfortunately I have zero ruby knowledge, but I will try and figure out if i can do that tomorrow.

andyce1010 avatar Dec 13 '21 17:12 andyce1010