jeddeloh / rescript-apollo-client

ReScript bindings for the Apollo Client ecosystem
MIT License
126 stars 18 forks source link

MockedProvider bindings #112

Closed Arnarkari93 closed 2 years ago

Arnarkari93 commented 3 years ago

How would we approach writing bindings for MockedProvider? The mocks prop is so dynamic and I am struggling where to begin. Has anybody thought about this?

jeddeloh commented 3 years ago

Hey, sorry for the slow reply. I'll take a look at this soon, but before I do, have you considered just writing a simple binding typed in the way you use it rather than trying to represent all the dynamic props?

Arnarkari93 commented 3 years ago

Isn't going to be an issue that rescript Apollo client is extended and defines a method rescript_query? I can't just make a simple binding for mockedProvider and say it is ApolloClient.t

jeddeloh commented 3 years ago

Ah, yes, sorry. I only used MockedProvider for a short while a long time ago and thought I remembered you being able to provide a client. This may be a pretty serious consequence of having gone the route of representing objects as records rather than keeping every method as a separate function.

I'm not sure the best way to proceed here. On the one hand, MockedProvider seems dead simple. It's mostly a convenience function for creating a client using MockLink and some teardown. Maybe just recreate it in rescript?

Thoughts?

Arnarkari93 commented 3 years ago

Sorry for the late response. Yes, I think recreating it in rescript is a good solution. I don't think I will be working with this library anytime soon, but If I do, I will check it out.