-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Labels
Meeting discussionTo mark issues we want to discuss in the weekly meetingTo mark issues we want to discuss in the weekly meeting
Description
The @Source annotation is a very convenient way of mixing fields from different domains into a single query without polluting the source entity with unrelated fields:
class SuperHero { String id, name; }
class Team { String id, name; }
Team team(@Source SuperHero superHero) {
return teamRepository.getTeamFor(superHero);
}But this doesn't work for input types (e.g. for mutations): they need the fields to be added explicitly, e.g. a team field in the SuperHero. Maybe we could add an @Target annotation as an alternative:
void team(@Target SuperHero superHero, Team newTeam) {
teamRepository.updateTeamFor(superHero, newTeam);
}- The
SuperHeroInputtype would have ateamfield, even when theSuperHeroclass doesn't. - When a client passes a
SuperHeroInputin a request that contains ateamfield, the core mutation is called ignoring theteamfield, although this field doesn't exist in theSuperHeroclass. But the aboveteammethod is called just after. - If the parameter annotated as
@Targetis also annotated as@Source, then the method is also mapped into the result object, using the method name as the field name and the return type as the field type.
Metadata
Metadata
Assignees
Labels
Meeting discussionTo mark issues we want to discuss in the weekly meetingTo mark issues we want to discuss in the weekly meeting