-
-
Notifications
You must be signed in to change notification settings - Fork 466
Open
Description
What problem does this feature proposal attempt to solve?
When defining types that implement an interface is very verbose having to specify the resolver on each of the type fields when using a custom resolver. Look at this example:
# User interface
interface User {
accountType: AccountType! @rename(attribute: "account_type")
id: UserId!
name: String!
url(lang: String!): String!
}
# UserGroup type
type UserGroup implements User {
accountType: AccountType! @rename(attribute: "account_type")
id: UserId!
name: String!
url(lang: String!): String! @field(resolver: "App\\GraphQL\\Types\\User\\Url")
}
# UserPersonal type
type UserPersonal implements User {
accountType: AccountType! @rename(attribute: "account_type")
id: UserId!
name: String!
url(lang: String!): String! @field(resolver: "App\\GraphQL\\Types\\User\\Url")
firstName: String! @rename(attribute: "first_name")
lastName: String! @rename(attribute: "last_name")
}
That @field directive in the types is repetitive and ugly, because is not even possible to use a short form like User\\Url.
Which possible solutions should be considered?
Would be good if this would be automatically inferred, avoiding the need to use the @field directive. In the example, the custom resolver is placed in Types\User\Url, denoting that the resolver is common to any type implementing User.
Metadata
Metadata
Assignees
Labels
No labels