aws-appsync-community icon indicating copy to clipboard operation
aws-appsync-community copied to clipboard

GraphQL Interface Inheritance result in "Failed to parse schema document - ensure it's a valid SDL-formatted document.", despite being valid SDL

Open the-simian opened this issue 9 months ago • 1 comments

Description

AWS AppSync rejects valid GraphQL schemas that contain interface inheritance, despite this being part of the official GraphQL specification. The schema passes validation in standard GraphQL validators but fails in AppSync.

Reproduction

This minimal example demonstrates the issue:

interface Node {
  id: ID!
}

interface Character implements Node {
  id: ID!
  name: String!
}

type Human implements Character {
  id: ID!
  name: String!
  height: Float
}

type Query {
  humans: [Human]
}

The above schema follows the official GraphQL specification example from the docs (https://graphql.org/learn/schema/#interface-types) but fails in AppSync with:

Failed to parse schema document - ensure it's a valid SDL-formatted document.

You can reproduce this issue by:

  1. Using the AWS CLI:
aws appsync start-schema-creation --definition schema.graphql --api-id YOUR_API_ID
  1. Pasting the schema in the AppSync console UI

  2. Using infrastructure as code tools like Pulumi or CloudFormation

Working Alternative

While interface inheritance fails, implementing multiple interfaces directly on a type works:

interface Node {
  id: ID!
}

interface Character {
  id: ID!
  name: String!
}

type Human implements Node & Character {
  id: ID!
  name: String!
  height: Float
}

type Query {
  humans: [Human]
}

Expected Behavior

AppSync should accept both schemas as they are both valid according to the GraphQL specification, which explicitly states:

"Interface types may also implement other Interface types."

Impact

This limitation forces developers to:

  • Duplicate fields across interfaces
  • Work around a limitation that doesn't exist in the spec
  • local linting and validation will pass, but deployment will fail

the-simian avatar Mar 04 '25 04:03 the-simian

I have opened cases with AWS Support about this, and they have confirmed that the AppSync SDL parser does not support the most recent 2021 GraphQL standard that adds interfaces implementing interfaces. I have not received any indication that this fix is a priority for the AppSync team.

ryancausey avatar Jul 04 '25 21:07 ryancausey