Autogenerate schema types from supgergraph.graphql#68
Conversation
douglaswinter
left a comment
There was a problem hiding this comment.
Looks good. Minor points, up to you.
| "preview": "vite preview", | ||
| "lint": "eslint ." | ||
| "lint": "eslint .", | ||
| "codegen": "graphql-codegen --config codegen.ts" |
There was a problem hiding this comment.
Could this script have a more specific name? something to do with graphql or ever graph
| ## Updating Supergraph Schema Types | ||
|
|
||
| 1. Navigate to app containing folder (i.e. `.../atlas/apps/i15-1`) | ||
| 1. Update the `supergraph.graphql` schema from most recent `supergraph.graphql` schema from https://github.com/DiamondLightSource/graph-federation/releases |
There was a problem hiding this comment.
Numbering of these bullet points is a bit strange
There was a problem hiding this comment.
Not for this PR, but should look at a way of generating this repo-wide through a CI action.
DominicOram
left a comment
There was a problem hiding this comment.
Great, thank you! Love the documentation. I've added some comments as following #45 (which also does some auto generation) there may be some future confusion. Comments in code for the specifics.
| "preview": "vite preview", | ||
| "lint": "eslint ." | ||
| "lint": "eslint .", | ||
| "codegen": "graphql-codegen --config codegen.ts" |
There was a problem hiding this comment.
Should: Queue auto-gen uses "generate:queue", I would suggest this be something like "generate:graphql"
| @@ -0,0 +1,30 @@ | |||
| import type { CodegenConfig } from "@graphql-codegen/cli"; | |||
|
|
|||
| const config: CodegenConfig = { | |||
There was a problem hiding this comment.
Should: Can we call this file graphqlCodegen? Or something like that to differentiate with the queue generation
| ## Updating Supergraph Schema Types | ||
|
|
||
| 1. Navigate to app containing folder (i.e. `.../atlas/apps/i15-1`) | ||
| 1. Update the `supergraph.graphql` schema from most recent `supergraph.graphql` schema from https://github.com/DiamondLightSource/graph-federation/releases |
There was a problem hiding this comment.
Could: Presumably we can automate this step too so that we just run something that pulls the latest schema and generates? Happy to spin into new issue
There was a problem hiding this comment.
I think this is limited by how (stable) graph updates - currently this is a manual process to move to the latest release so the latest supergraph.graphql may not be what is currently in use... This could likely change in the future.
| @@ -0,0 +1,1339 @@ | |||
| type Artifact { | |||
There was a problem hiding this comment.
Could: Feels like this file should live in the graphql folder
There was a problem hiding this comment.
Related to Douglas's comment, I think eventually this will be common for all apps, but happy to move it into the graphql folder for the moment.
Fixes #63
Generates types from queries, mutations, etc. and supergraph.graphql using graphql-codegen.
Currently only used in i15-1.