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

Gateway and/or federated schema disregard description strings #2808

Closed
mandiwise opened this issue Jun 8, 2019 · 6 comments · Fixed by #2830
Closed

Gateway and/or federated schema disregard description strings #2808

mandiwise opened this issue Jun 8, 2019 · 6 comments · Fixed by #2830
Assignees

Comments

@mandiwise
Copy link
Contributor

Packages versions:

Expected behaviour:

Description strings (BlockString-style) will be rendered in GraphQL Playground.

Actual behaviour:

Description strings do not render.

However, when I add this schema to a standard Apollo server (no gateway/federation), the description strings appear in GraphQL Playground with their types/fields as expected.

Here's a sample of the documentation I've written for my schema:

"""
An ISO-8601-encoded UTC date string.
"""
scalar DateTime

"""
A user is an account that can create content.
"""
type User @key(fields: "id") {
  "The unique ID of the user."
  id: ID!
  "The date and time the user account was created."     
  createdAt: DateTime!
  "The user's email."
  email: String!
}
@jbaxleyiii
Copy link
Contributor

@mandiwise oh no! Thank you for this issue! We will take a look!

@mandiwise
Copy link
Contributor Author

Thanks @jbaxleyiii for looking into this. I've been doing further development and have just discovered that the issue with federation/gateway support for description strings in a service schema is a bit broader than what I originally reported.

Beyond simply ignoring description strings at the gateway level, it seems if you add a description string in front of an extend type in a federated service schema, the federated service will throw an error on start-up: GraphQLError: Syntax Error: Unexpected Name "extend".

As soon as you remove the description string before the extend type, the federated service will start up again.

Here's an example of the code that doesn't work:

"""
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
  "A short bio about the user (max. 256 characters)."
  bio: String
}

But this code works:

extend type User @key(fields: "id") {
  "The unique ID of the user."
  id: ID! @external
  "The URL of the user's avatar."
  avatar: String
  "A short bio about the user (max. 256 characters)."
  bio: String
}

I can see how it may be tricky to merge descriptions for types and external extensions of those types at the gateway level. But if this is something that won't be possible, it may help if it's documented. It took quite a while to track down the real cause of the syntax error.

I'm happy to create a separate issue for this if that's preferred.

@JacksonKearl
Copy link

Hey @mandiwise, thanks for diving into this a bit further! That looks to me like an issue with the parser rather than the original issue of not federating descriptions... but they might end up being the same thing in the end. I've created a seperate issue for now though.

@firaskafri
Copy link

Issue still persists when using buildService for RemoteGraphQLDataSource

@trevor-scheer
Copy link
Member

@firaskafri would you please open a separate issue with a runnable reproduction? Linking back to this issue may be helpful for context. Thank you!

@fu2re
Copy link

fu2re commented Jul 15, 2020

Still persist at 2.15.1

abernix pushed a commit to apollographql/federation that referenced this issue Sep 4, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants