Apollo-server: Federation: Syntax error when adding a description to an extended type

Created on 11 Jun 2019  ·  3Comments  ·  Source: apollographql/apollo-server

The federated schema

"""
A description of this extended type.
"""
extend type User @key(fields: "id") {
  "The unique ID of the user."
  id: ID! @external
  "The URL of the user's avatar."
  avatar: String
}

Results in GraphQLError: Syntax Error: Unexpected Name "extend" at parse. This does not happen if the description is removed.

(Thanks to @mandiwise for finding this, over in #2808)

👩‍🚀 federation

Most helpful comment

Turns out this is per-spec, only type definitions may have a description, type extensions may not. https://graphql.github.io/graphql-spec/June2018/#sec-Object-Extensions

All 3 comments

@jbaxleyiii Do you think extended types should be able to even have descriptions? It might make the most sense to prohibit/ignore descriptions on @external fields and extended types. What do you think?

Turns out this is per-spec, only type definitions may have a description, type extensions may not. https://graphql.github.io/graphql-spec/June2018/#sec-Object-Extensions

Good to know, thanks for the insight.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

manuelfink picture manuelfink  ·  3Comments

espoal picture espoal  ·  3Comments

stevezau picture stevezau  ·  3Comments

attdona picture attdona  ·  3Comments

Magneticmagnum picture Magneticmagnum  ·  3Comments