Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow compatibility when using introspection derived client schema's (#…
…145) During generation we parse the schema using [`gqlparser.LoadSchema`](https://github.com/vektah/gqlparser/blob/2a3d320c0f1d31f404cc36f6cce8f7f93b016682/gqlparser.go#L11) over [here](https://github.com/Khan/genqlient/blob/a4aa6d9bb0f45cb71b3b7816742172011d96fbc1/generate/parse.go#L34). As you can see `gqlparser.LoadSchema` uses it's sub directory declared [`validator.LoadSchema`](https://github.com/vektah/gqlparser/blob/2a3d320c0f1d31f404cc36f6cce8f7f93b016682/gqlparser.go#L12) - but prepends a schema with [typical implicit declared types](https://github.com/vektah/gqlparser/blob/2a3d320c0f1d31f404cc36f6cce8f7f93b016682/validator/prelude.go#L5). Full server schema introspection exposes the entire schema explicitly, hence causing a clash with this prelude schema rendering introspection derived schemas to fail. Here I just introduce a two stage schema parsing step to accomodate both implicit and explicit sdl's. -- I have also added to the FAQ as per #4 how we can use introspection to fetch the schema when using `genqlient`. Co-authored-by: Ben Kraft <[email protected]>
- Loading branch information