graphql_ppx icon indicating copy to clipboard operation
graphql_ppx copied to clipboard

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

Open MargaretKrutikova opened this issue 5 years ago • 1 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?

MargaretKrutikova avatar Aug 24 '19 20:08 MargaretKrutikova

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 :)

baransu avatar Aug 27 '19 15:08 baransu