RFC X / Rejected

Relax SameResponseShape algorithm to be compatible with covariant fields

Opened on2021-09-02
Closed on2022-01-06

At a glance

Spec PR description

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.

Timeline

  • Spec PR created on 2021-09-02 by IvanGoncharov
  • Commit pushed on 2021-09-02 by IvanGoncharov: Relax SameResponseShape algorith to be compatible with covariant fields
  • Added to WG agenda on 2021-09-02
  • Mentioned in WG notes on 2021-09-02