Skip to content

[BUG] Mappers are not applied to Interfaces #278

@eddeee888

Description

@eddeee888

From #266 (comment)

Thanks for the fix above! I created another repo here for a related bug where the mapper for the interface type itself isn't being set properly as the Resolver return type.

The way I was anticipating it would work is that (based on the example in the linked repo):

  1. The user query returns a User interface type. It should expect the return value of the UserMapper
  2. The __resolveType on User.ts should have the UserMapper as the parent type, and can be used to dictate which of the implementing types is being returned
  3. The parent for AdminUser type resolver functions should be the AdminMapper (and similar for CustomerMapper). If they are not defined then it should default to UserMapper as the parent type.
    Please let me know if I'm thinking about this the wrong way! The reason I would like these types is that I have a base table in my DB that maps cleanly to the interface type, but we need to fetch additional data to resolve fields on the actual object type.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions