graphql-codegen patch
We maintain a pnpm patch against
[email protected]
to add @oneOf directive support for Zod schema generation, sourced from
Jabolol/graphql-codegen-typescript-validation-schema
on branch jabolol/one-of-directive-support.
Relevant files:
- Patch:
apps/frontend/patches/[email protected] - Config:
pnpm-workspace.yaml→patchedDependencies - Fork changes:
src/zod/index.ts,src/zodv4/index.ts
Regenerating the patch
Clone/update the fork, build it, then:
# From OSO repo root
pnpm patch [email protected]
# Copy the six changed dist files into <TEMP_DIR>
FORK=/path/to/fork
TEMP=<TEMP_DIR>
for dir in cjs esm; do
cp $FORK/dist/$dir/zod/index.js $TEMP/dist/$dir/zod/index.js
cp $FORK/dist/$dir/zodv4/index.js $TEMP/dist/$dir/zodv4/index.js
done
cp $FORK/dist/types/zod/index.d.ts $TEMP/dist/types/zod/index.d.ts
cp $FORK/dist/types/zodv4/index.d.ts $TEMP/dist/types/zodv4/index.d.ts
pnpm patch-commit '<TEMP_DIR>'
cd apps/frontend && pnpm graphql:codegen
Dropping the patch
Once upstream ships @oneOf support, remove patchedDependencies from
pnpm-workspace.yaml, delete the patch file, and bump the version in
apps/frontend/package.json.