Uh oh!
There was an error while loading. Please reload this page.
feat(core): generate TypeScript types from the GraphQL queries - #475
feat(core): generate TypeScript types from the GraphQL queries#475marcalexiei wants to merge 1 commit into
Conversation
@marcalexiei is attempting to deploy a commit to the martin-mfg's projects Team on Vercel. A member of the Team first needs to authorize it. |
9b1d028 to
5ccd96cComparemartin-mfg
commented
Aug 12, 2026
|
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
5ccd96c to
7aadeacCompareThe guide recommends Three things moved this PR off it:
This costs a 253-line script and one post-process (dropping the P.S.: I reverted the WakaTime card migration. |
martin-mfg
left a comment
There was a problem hiding this comment.
I have only looked at generate-graphql-types.js so far:
| const subsetSchemaAst = buildSchema( | ||
| [...variableTypeNames] | ||
| .map((name) => schemaAst.getType(name)) | ||
| .filter((type) => !!type && !type.name.startsWith("__")) |
There was a problem hiding this comment.
Could you please add a comment explaining this line? I tried removing it, but the output didn't change.
There was a problem hiding this comment.
I deleted all *.graphql files except for gist.graphql and ran pnpm --filter ./packages/core/ run generate-graphql-types. This threw an error. Presumably because there is nothing to be generated for common.ts then. Could you verify and fix this please?
| if (checkOnly) { | ||
| drifted.push(path.relative(PACKAGE_ROOT, path.join(OUT_DIR, file))); | ||
| } else { | ||
| await fs.rm(path.join(OUT_DIR, file)); |
There was a problem hiding this comment.
Please log a message when deleting files here.
The queries moved to
src/graphql/queries/*.graphqland their types are generated fromGitHub's schema instead of hand-written.
scripts/generate-graphql-types.jsvalidates each query against@octokit/graphql-schemaand writes one file per query plus a sharedcommon.ts,so a wrong field fails generation and a wrong variable fails
tsc.pnpm check-graphql-typesruns in CI, so the generated types can't drift.httpGraphQLRequesttakes a generated document: the four*QueryResponseinterfaces are gone andGRAPHQL_REPOS_FIELDis a real fragment.Untyped
requeststays exported for the backend, with a TODO for considering its removal.ownerandfiles[].name,user,repositories.nodes);Lang.coloris nullable againparseOwnerAffiliationsreturns the schema'sRepositoryAffiliation.graphqlstays on 16:@octokit/graphql-schemaneeds^16.Warning
The four
apps/backendcontract snapshots were refreshed:the recorded request text changed, the rendered SVGs did not.