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

GraphQLSyntaxError When An Object Type Is Implementing Multiple Interfaces #235

Open
alxjhnsn opened this issue Mar 13, 2025 · 0 comments
Open

Comments

@alxjhnsn
Copy link

Hi team!

I have a program that is comparing schemas, and it's currently failing when loading and parsing a schema that has a type implementing multiple interfaces:

Traceback (most recent call last):
  File "/Workspace/devops/graphql_diff/venv/lib/python3.11/site-packages/graphql/utilities/build_ast_schema.py", line 96, in build_schema
    parse(
  File "/Workspace/devops/graphql_diff/venv/lib/python3.11/site-packages/graphql/language/parser.py", line 113, in parse
    return parser.parse_document()
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Workspace/devops/graphql_diff/venv/lib/python3.11/site-packages/graphql/language/parser.py", line 241, in parse_document
    definitions=self.many(TokenKind.SOF, self.parse_definition, TokenKind.EOF),
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Workspace/devops/graphql_diff/venv/lib/python3.11/site-packages/graphql/language/parser.py", line 1156, in many
    append(parse_fn())
           ^^^^^^^^^^
  File "/Workspace/devops/graphql_diff/venv/lib/python3.11/site-packages/graphql/language/parser.py", line 302, in parse_definition
    raise self.unexpected(keyword_token)
graphql.error.syntax_error.GraphQLSyntaxError: Syntax Error: Unexpected Name 'DealBookEndPageFields'.

GraphQL request:1988:61
1987 |
1988 | type EndPageNode implements PageBaseFields, EndPageFields {
     |                                             ^
1989 |   id: Int!

Here are the types causing the failure:

interface PageBaseFields {
  id: Int!
  name: String!
  order: Int!
  layout: PageLayoutEnum!
  background: String
  showPageNumber: Boolean
  showBookmarks: Boolean
  includeInBookmarks: Boolean
  hideable: Boolean
  deletable: Boolean
  locked: Boolean
}

interface PageFields {
  image: String
  content: String!
  cards: [String]
}

type EndPageNode implements PageBaseFields, EndPageFields {
  id: Int!
  name: String!
  order: Int!
  layout: PageLayoutEnum!
  background: String
  showPageNumber: Boolean
  showBookmarks: Boolean
  includeInBookmarks: Boolean
  hideable: Boolean
  deletable: Boolean
  locked: Boolean
  image: String
  content: String!
  cards: [String]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant