Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misleading composition hints when using @interfaceObject #2397

Closed
dariuszkuc opened this issue Feb 15, 2023 · 3 comments · Fixed by #2412
Closed

misleading composition hints when using @interfaceObject #2397

dariuszkuc opened this issue Feb 15, 2023 · 3 comments · Fixed by #2412

Comments

@dariuszkuc
Copy link
Member

Given a simple schema

// subgraph A
interface Inventory @key(fields: "id") {
  id: ID!
  products: [Product!]!
}

type OpenSourceInventory implements Inventory @key(fields: "id") {
  id: ID!
  products: [Product!]!
}

// subgraph B
type Inventory @interfaceObject @key(fields: "id") {
  id: ID!
  deprecatedProducts: [DeprecatedProduct!]!
}

We are getting misleading composition hints:

rover HINT: [INCONSISTENT_INTERFACE_VALUE_TYPE_FIELD]: Field "Inventory.products" of interface type "Inventory" is defined in some but not all subgraphs that define "Inventory": "Inventory.products" is defined in subgraph "inventory" but not in subgraph "products".
rover HINT: [INCONSISTENT_INTERFACE_VALUE_TYPE_FIELD]: Field "Inventory.deprecatedProducts" of interface type "Inventory" is defined in some but not all subgraphs that define "Inventory": "Inventory.deprecatedProducts" is defined in subgraph "products" but not in subgraph "inventory".

It looks like the hints are unaware that Inventory interface is an entity so the differences in fields are expected.


Repro available in apollographql/apollo-federation-subgraph-compatibility repo (apollo-server and federation-jvm implementations were updated to v2.3 tests).

To run tests, execute following make target from root dir:

make test subgraph=apollo-server
@atomheartother
Copy link

Oh hey, I actually reported this yesterday in rover!

apollographql/rover#1511

pcmanus pushed a commit to pcmanus/federation that referenced this issue Feb 21, 2023
The code that generates the `INCONSISTENT_INTERFACE_VALUE_TYPE_FIELD`
was run inconditionally on all interfaces. However, with the
introduction of `@interfaceObject` and `@key` on interfaces, we now
essentially support "entity" interfaces, and it is misleading to
generate this hint for those interfaces. This commit fixes that.

Fixes apollographql#2397
@pcmanus
Copy link
Contributor

pcmanus commented Feb 21, 2023

@sachindshinde: noticed you were set as assignee, so hope you don't mind, but took the liberty to create a quick PR for this (#2412) since I was looking at this, it's fairly trivial to fix, and it's ultimately my fault for forgetting to update this in the @interfaceObject PR. Maybe I can entice you to review ? :)

@sachindshinde
Copy link
Contributor

@pcmanus No worries there, thanks for the quick fix! I'm down to review 🙂

pcmanus pushed a commit that referenced this issue Feb 22, 2023
The code that generates the `INCONSISTENT_INTERFACE_VALUE_TYPE_FIELD`
was run inconditionally on all interfaces. However, with the
introduction of `@interfaceObject` and `@key` on interfaces, we now
essentially support "entity" interfaces, and it is misleading to
generate this hint for those interfaces. This commit fixes that.

Fixes #2397
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants