Skip to content

RFC: New way to declare resolvers #88

Open
@neelance

Description

@neelance

I've just been to the GraphQL Europe conference and it got me thinking about how we specify resolvers. Using Go methods seemed nice at first, but is that really the best way? Please take a look at this alternative:
https://github.com/neelance/graphql-go/blob/new-resolvers/example/starwars/starwars.go#L291

Advantages:

  • no resolver wrappers, especially good for list results
  • API easier to learn
  • clean shortcuts like ResolverField
  • most type checking at startup is still possible
  • explicit name mapping between GraphQL and Go
  • automatic handling of GraphQL type assertions

Disadvanatages:

  • no type checking on return value if type is a GraphQL interface (they map to Go's interface{})

What do you think?

/cc @F21 @nicksrandall @acornejo @bsr203 @EmperorEarth

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions