Open Coobaha opened 5 years ago
Interesting idea, I'm not sure how easy it would be to tack this on to the current implementation. Maybe this would be another "output mode" that you could specify as an argument to the ppx.
Another thing; it's not just @bsRecord
that would require parsing, but unions/interfaces and enums too.
Hi @mhallin
I encountered problem trying to update Apollo cache with
readQuery/writeQuery
. I need to know shape ofJs.Json.t
which is passed to parse (Js.Json.t => t
). Parse guarantees that JSON shape is valid in the runtime but it should be possible to have it as a static type based on gql query string?Cache holds
Js.Json.t
. It's type is unknown currently and it will be incorrect to uset
if@bsRecord
is used.Would it be possible to have alternative version that trusts that data comes from graphql endpoint? In other words less runtime type save (which should not be the case if data comes from graphql server) but more exact and performant. So it will parse json only when needed, for instance for @bsRecord.
Or at least some raw jsT could be introduced to use with apollo cache