Skip to content

federation gateway should throw on type's conflicts #826

@Eomm

Description

@Eomm

Given the following schemas:

Node 1

    extend type Query {
      getOrder: Order
    }

    type Order @key(fields: "id") {
      id: ID!
      name: String
    }

Node 2

  type Order @key(fields: "id") {
    id: ID!
    surname: String
  }

The gateway starts correctly instead of throwing.

This is a clear developer's error, as the Node 2's schema should use the extends keyword:

  extends type Order {
    surname: String
  }

In this case, Mercurius should throw an error when:

  • there is a naming conflict without the extends keyword
  • the extends entity must not use the ID! property value

In both the above cases, Apollo server trigger this error:

This data graph is missing a valid configuration. Field "Order.id" can only be defined once.

There can be only one type named "Order".

This would help developers to spot these schema conflicts at first gateway run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions