Skip to content

Generated SDK types export (Pydantic + Zod) from the proto; money as exact decimal #11

Generated SDK types export (Pydantic + Zod) from the proto; money as exact decimal

Generated SDK types export (Pydantic + Zod) from the proto; money as exact decimal #11

Workflow file for this run

name: sdk-types-ci
# Drift gate for the generated TYPES EXPORT (Pydantic + Zod). Regenerates from the
# proto via scripts/gen-sdk-types.sh and fails if the committed output differs — the
# same regenerate-and-diff contract as the gen/ drift gate, for the SDK types. Runs
# only when the proto, the descriptor, the generators, or the committed output change.
on:
push:
branches: [main]
paths: &paths
- 'proto/**'
- 'gen/descriptor.binpb'
- 'scripts/gen-sdk-types.sh'
- 'scripts/check-canonical.sh'
- 'scripts/sdk-types/**'
- 'conformance/**'
- 'gen/python/**'
- 'gen/ts/**'
- '.github/workflows/sdk-types-ci.yml'
pull_request:
paths: *paths
jobs:
sdk-types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: bufbuild/buf-setup-action@v1
with:
version: 1.66.1
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/setup-node@v4
with:
node-version: 22
- name: regenerate types export
run: ./scripts/gen-sdk-types.sh
# Only the two generated files; wire/base.py is hand-written (the seam) and the
# vocab constants are generated by buf, gated separately.
- name: assert no drift
run: |
if ! git diff --exit-code -- gen/python/wire/models.py gen/ts/wire/schemas.ts; then
echo "::error::Generated types export is out of sync with the proto. Run scripts/gen-sdk-types.sh and commit gen/python/wire/models.py + gen/ts/wire/schemas.ts."
exit 1
fi
# Cross-language validation parity: the generated Pydantic models and Zod schemas
# must reach the SAME verdict as Go protovalidate on every case in the generated
# corpus (conformance/corpus/cases.json) — proving the proto -> JSON Schema ->
# client pipeline carries every field-level rule. The corpus is pinned to
# protovalidate by the Go conformance suite (proto-ci) and gated for drift there.
- name: Python (Pydantic) parity
run: |
python -m pip install -q "pydantic>=2.0" pytest
PYTHONPATH=gen/python pytest gen/python/tests -q
- name: TypeScript (Zod) parity
working-directory: gen/ts
run: |
npm install
npm test
# Canonical proto-JSON interop: each client re-serializes every valid corpus
# instance and the emission, read back through Go protojson, must decode to the
# same proto message as the original (incl. Timestamp/Duration). Reuses the
# .sdk-types-work venv + zod provisioned by gen-sdk-types.sh above.
- name: Canonical proto-JSON round-trip
run: ./scripts/check-canonical.sh