Skip to content

Autogenerate schema types from supgergraph.graphql#68

Merged
EmsArnold merged 4 commits into
mainfrom
63_autogenerate_schema_types
Jun 15, 2026
Merged

Autogenerate schema types from supgergraph.graphql#68
EmsArnold merged 4 commits into
mainfrom
63_autogenerate_schema_types

Conversation

@EmsArnold

Copy link
Copy Markdown
Contributor

Fixes #63

Generates types from queries, mutations, etc. and supergraph.graphql using graphql-codegen.

Currently only used in i15-1.

@douglaswinter douglaswinter left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Minor points, up to you.

Comment thread apps/i15-1/package.json Outdated
"preview": "vite preview",
"lint": "eslint ."
"lint": "eslint .",
"codegen": "graphql-codegen --config codegen.ts"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this script have a more specific name? something to do with graphql or ever graph

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, great minds... #68 (comment)

Comment thread apps/i15-1/README.md
## 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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Numbering of these bullet points is a bit strange

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but should look at a way of generating this repo-wide through a CI action.

@DominicOram DominicOram left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread apps/i15-1/package.json Outdated
"preview": "vite preview",
"lint": "eslint ."
"lint": "eslint .",
"codegen": "graphql-codegen --config codegen.ts"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should: Can we call this file graphqlCodegen? Or something like that to differentiate with the queue generation

Comment thread apps/i15-1/README.md
## 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could: Feels like this file should live in the graphql folder

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@EmsArnold
EmsArnold requested a review from DominicOram June 15, 2026 07:40

@DominicOram DominicOram left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@EmsArnold
EmsArnold merged commit bfb6b79 into main Jun 15, 2026
1 of 2 checks passed
@EmsArnold
EmsArnold deleted the 63_autogenerate_schema_types branch June 15, 2026 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use the graphQL schema to build types

3 participants