alexsteinerde / graphql-kit

Easy setup of a GraphQL server with Vapor. It uses the GraphQL implementation of Graphiti.
MIT License
99 stars 18 forks source link

Any plan to support to async await resolvers ? #21

Open Samsv77 opened 1 year ago

Samsv77 commented 1 year ago

Hi, Swift GraphQL supports resolvers with async throws, in addition to NIO eventLoop. Do you have any plan to provide support for them too ?

bdrelling commented 1 year ago

Same question. @alexsteinerde, can you let us know your plans for this repository? Thanks!

alexsteinerde commented 1 year ago

The async/await support comes with Graphiti already built in. This package is only a layer on top with additional resolver functions for Fluent objects which don't require mention EventLoops to the public API at the moment. So updating Graphiti should give you async/await resolvers.

Or do you have any specific function that ships with this package and doesn't support async/await?

Samsv77 commented 1 year ago

The native Graphiti methods are not integrated with Vapor and Fluent, in particular the request object. So we can't use the async throws method without adding the Vapor integration layer manually.

alexsteinerde commented 1 year ago

I'm sorry but I currently don't see any EventLoops in the public interface. Could you please provide me with an example? Probably I just missed a place.

GiovanniLuigi commented 9 months ago

Maybe he's referring to public func register<RootType>(graphQLSchema schema: Schema<RootType, Request>, withResolver rootAPI: RootType, at path: PathComponent="graphql", postBodyStreamStrategy: HTTPBodyStreamStrategy = .collect)

kylebrowning commented 1 month ago

You use -> Future<GraphQLResult> Rather than async -> GraphQLResult