Skip to main content

Relax SameResponseShape algorithm to be compatible with covariant fields

At a glance​

Timeline​


At the moment covariance rules for interfaces are incompatible with validation rule for overlapping fragments. For example, if we have schema like this:

interface AddressInterface {
country_code: String
}

type Port implements AddressInterface {
country_code: String!
}

type Warehouse implements AddressInterface {
country_code: String
}

type Query {
addressInterface: AddressInterface
}

This query is valid:

query {
addressInterface {
country_code
}
}

But if you expand interface field into inline fragments will cause a validation error:

query {
addressInterface {
... on Port {
country_code
}
... on Warehouse {
country_code
}
}
}

This PR fixes this issue.