feat: add auto-generated Zod schemas and drift detection#124
Merged
Conversation
- Add openapi-zod-client integration to generate Zod schemas from OpenAPI specs - Implement drift detection to identify API changes and trigger schema regeneration - Add npm scripts: generate-schemas and detect-drift - Create workflows: regenerate-schemas.yml and drift-detection.yml - Add Slack notifications for drift alerts and schema regeneration PRs Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
The scope3data/actions/node/install composite action is not resolvable in PR CI context. Revert to the original setup-node + npm ci approach.
- Add /* eslint-disable */ header to generated buyer.ts to suppress lint errors on auto-generated code - Fix unnecessary \& escape characters in generated output - Update generate-schemas.ts post-processing to apply both fixes - Add changeset for the zod schemas feature Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Strip @zodios/core dependency and @ts-nocheck from generated schemas - Remove tsconfig exclusion so schemas compile to dist/ - Export schemas from package entry point (src/index.ts) - Consumers can now import { buyer } from 'scope3' for full IntelliSense Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace external trigger dependency with GitHub Actions cron schedule. Manual workflow_dispatch is still available for ad-hoc runs.
- Add SLACK_TOKEN env to both drift-detection and regenerate-schemas workflows - Replace actions/github-script dispatch with workflow_call (reusable workflow) since GITHUB_TOKEN cannot trigger workflow_dispatch on other workflows - Add job output to pass drift_detected flag between jobs
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Consumers who need z can import it directly from zod. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace the hardcoded SDK_METHODS inventory with three automated sources: - OpenAPI spec: fetched from staging and parsed for all path/method pairs - skill.md: already fetched via existing fetcher (unchanged) - SDK code: extracted by scanning src/resources/*.ts for adapter.request() calls The report now shows a three-way comparison with the OpenAPI spec as source of truth, highlighting where skill.md and SDK each diverge. Also updates the GitHub workflow's Slack message to show the new drift categories. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add post-processing to normalize snake_case schema names to PascalCase - Remove duplicate aliases that collapse to the same name after rename - Check for existing open regeneration PRs before creating a new one - Remove z re-export from generated index.ts
nastassiafulconis
approved these changes
Mar 18, 2026
Collaborator
nastassiafulconis
left a comment
There was a problem hiding this comment.
solid first pass! the automated drift detection + regeneration loop is a nice pattern. main thing to fix before this ships is the staging vs prod URL mismatch in detect-drift.ts — everything else is non-blocking. the naming inconsistencies in buyer.ts and the Error shadowing are worth cleaning up in a follow-on.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds auto-generated Zod schemas from OpenAPI specs with drift detection and automatic schema regeneration.
Changes:
import { buyer } from 'scope3')Resolves the need for manual type maintenance by automating schema generation based on live API specs.
Next Steps
The generated schemas are exported but not yet used internally by the SDK. A follow-up PR should:
z.infer<typeof schema>insrc/types/so schemas become the single source of truth instead of maintaining duplicate interfacesRestAdapter/McpAdapter) to catch API contract mismatches early