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

Incorrect @key federation directives do not get handled properly #850

Closed
ahctangU opened this issue Jul 2, 2021 · 1 comment
Closed

Comments

@ahctangU
Copy link

ahctangU commented Jul 2, 2021

Situation:

If I am uploading a schema with incorrect directive syntax, for example: (Notice the missing quotation marks)

  type MediaChapter @key(fields: id) {
    id: ID!
    nameJa: String!
    thumbnailUrl: String!
    contentTags: [ContentTag!]!
    length: String!
    timeCodeType: String!
    """
    In HH:MM:SS:FF format
    """
    startTimeCode: String!
    """
    In HH:MM:SS:FF format
    """
    endTimeCode: String!
    timeCodeMode: String!

    performances: [MediaPerformance!]!
    credits: [CapyCredit!]!
    parent: Media!
  }

rover subgraph introspect will not error. rover subgraph check will not error. Everything will pass! In fact, the directive will even render in Apollo Studio! However, when you actually try to compose the schema, the next subgraph check and publish will report the following error:

MediaChapter -> appears to be an entity but no @key directives are specified on the originating type.

I don't know what approach the Apollo team wants to take for this, but it was absolutely maddening to debug since every tool in the stack was reporting OK when it was in fact NOT OK.

@abernix
Copy link
Member

abernix commented Jul 2, 2021

Thanks very much for filing an issue here! This must have been frustrating, indeed. While this is syntactically valid GraphQL (the unquoted id is merely parsed as an enum property!) there is almost certainly something we can do to improve this via validation. Thanks again!

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

No branches or pull requests

2 participants