graphql-core icon indicating copy to clipboard operation
graphql-core copied to clipboard

GraphQLSyntaxError When An Object Type Is Implementing Multiple Interfaces

Open alxjhnsn opened this issue 9 months ago • 1 comments

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]
}

alxjhnsn avatar Mar 13 '25 20:03 alxjhnsn