We have an interface called Displayable
dictating that types have a field called title
. Now in the context of the federation, one API returns data from types that implement this interface (e.g. a Track
), but it also defines a PageSection
which also implements Displayable
. The consequence of this is that the Displayable
interface needs to be defined twice in the code, where in one of them, title
needs to be marked as external
.
The main difference is that title
is provided by another API in the case of Track
, while its meant to be provided by the current API in the case of PageSection
.
federation_entities.py:
@strawberry.interface()
class Displayable:
title: Optional[str] = strawberry.federation.field(external=True)
@strawberry.federation.type(extend=True, keys=["id"])
class Track(Displayable):
id: strawberry.ID = strawberry.federation.field(external=True)
@classmethod
def resolve_reference(cls, id):
return Track(id)
section_entities.py:
from federation_entities import Track
@strawberry.interface()
class Displayable:
title: Optional[str]
@strawberry.type
class PageSection(Displayable):
section_items: typing.List[Track]
This behaviour worked before the introduction of DuplicatedTypeName
. But I'm not sure how to work around it now.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too