apollo-ios
apollo-ios copied to clipboard
1.x Feature - Directive to extend fields with protocol conformance
To be clearer about my proposal, I mean something like this:
/// You define this protocol
protocol CharacterName {
var name: String { get }
}
/// You define this extension
extension CharacterName {
var nameAllCaps: String { self.name.uppercased() }
}
In your graphql query:
query {
hero @extends("CharacterName") {
id
name
}
}
/// The directive would make the generated code add this extension for the generated type.
extension HeroDetailsQuery.Data.Hero: CharacterName {}
Would that be adequate for you @Mordil? It's not totally automatic, but it is cleaner and easier than the status quo.
Yes, that is adequate and seems to address many cross-cutting concerns.
Thanks for keeping up with this request!
Haha, sorry, we didn't mean to copy over tagging you! I know we already had this conversation :)