Skip to content

@EntityMapping should support object types that implement multiple interfaces #1414

@klys-equinix

Description

@klys-equinix

For example, I have an interface Asset, that has multiple implementations, but also a few interfaces extending it with different properties, ex:

interface Asset @key(fields: "maximoUid") {


interface UsesInBoardAsset implements Asset @key(fields: "maximoUid") {


type Breaker implements Asset & UsesInBoardAsset 
@key(fields: "maximoUid") {

I have implemented an entity resolver:

  @EntityMapping(value = "Asset")
  fun assetEntities(
      @Argument(name = "maximoUid") maximoUids: List<String>,
      env: DataFetchingEnvironment,
  ) = env.loadAssetsByMaximoUids(maximoUids)

Which works correctly for concrete type Breaker, but is not registered for interface UsesInBoardAsset.

Whatsmore, if I manually implement mapping for those interfaces, I get

Caused by: java.lang.IllegalStateException: Object type 'Breaker' implements two EntityMapping interfaces: 'UsesInBoardAsset' and 'Asset'.

Releated to:
#1356

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions