mhallin / graphql_ppx

GraphQL PPX rewriter for Bucklescript/ReasonML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to convert parsed result back to the original type?

MargaretKrutikova opened this issue · comments

I am using graphql_ppx with reason-apollo and I am struggling with cache updates in apollo. The objects in cache are plain JS objects, that are parsed when read from the cache, so that they are converted to records if using @bsRecord and all @bsDecoder directives are applied too.

However, when writing back to cache I need to convert the object to the original structure since cache wants plain JS objects with all their field values intact, so that they are properly converted next time the query is read from cache.

Is there any way to convert the parsed object back to the original response type?

I'm struggling with it too. There is #71 but no one is actively working in this repo on this. I have graphql_ppx_re which is Reason version of this ppx with work in progress branch trying to implement such feature. Help is welcome :)