Open kompfner opened 7 years ago
I think these changes make a lot of sense. @Poincare, what do you think?
We may want to add a root object and put the operations under an operations
key. I think it would be great if we could specify some standard metadata, like app name and version, which a server or other tool can use to tag operations.
@martijnwalraven @kompfner This makes sense. I haven't yet delved deeply into the apollo-codegen PR but the core idea of using the operation hashes seems great. Will look into this in more detail shortly.
In a recent PR to apollo-codegen, a mechanism for generating unique operation IDs was introduced. In addition, it introduced a generated output file that maps between these IDs and the corresponding operation text, for use in registering operations with a server for persistence and whitelisting. The rationale for not simply using
persistgraphql
is contained in the PR description.This proposed output file differs from
persistgraphql
's output in a few important ways:As pointed out by @martijnwalraven, there are good reasons to align the approaches taken by
apollo-codegen
andpersistgraphql
:There is an existing issue on
persistgraphql
that addresses difference point 1. I think switching to operation hashes is the right approach.What I’d like to propose here is that, to address difference points 2 and 3,
persistgraphql
adopt the approach proposed in theapollo-codegen
PR. The PR lays out an argument for this approach, which I’ll recap here: