aws / aws/aws-appsync-community
GraphQL Interface Inheritance result in "Failed to parse schema document - ensure it's a valid SDL-formatted document.", despite being valid SDL
- Dominant language
- HTML
- Stars
- 507
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
## 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:
```graphql
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
```
2. Pasting the schema in the AppSync console UI
3. Using infrastructure as code tools like Pulumi or CloudFormation
## Working Alternative
While interface inheritance fails, implementing multiple interfaces directly on a type works:
```graphql
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
Contributor guide
Research direction
Start with the minimal schema in the issue, saved as schema.graphql, and run the AWS CLI command shown against an AppSync API; compare it with the working multiple-interface schema. Confirm the failure in the AppSync console or through Pulumi or CloudFormation, and consider the issue done when valid interface inheritance is accepted without the parse error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, graphql
- Domain
- api
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100