api-platform / api-platform/core

Entity inheritance to GraphQL interface

Open
#6,117 3 comments 8 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
2.6k
Forks
980
Avg merge
2d 2h
Merged PRs (30d)
51

Description

I like the approach of GraphQLite: if Cat and Dog both inherit from some Animal class (stored in the database using either single table inheritance or class table inheritance), then the GraphQL schema generated will have an AnimalInterface which is then implemented by Cat and Dog. This allows one to perform queries like:

```
animals {
id
... on Cat {
someCatSpecificField
}
... on Dog {
someDogSpecificField
}
}
```

to fetch all Animals along with their implementation-specific fields. Unless I'm missing something, this is not possible with API Platform? My application makes use of inheritance a lot so annoyingly it's pretty much just this issue that is ruling out API Platform.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.