ref(schema): Unify model schema definitions - #527
Draft
Lms24 wants to merge 11 commits into
Draft
Conversation
Establish canonical Zod models and inferred types for non-attribute schema consumers. Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Use canonical Zod schemas for fail-fast loading across scripts and model tests, removing duplicate hand-maintained model types. Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Generate committed JSON Schemas from the canonical Zod definitions and verify equivalent validation behavior with AJV. Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Share model validation between Astro and the generated compatibility schemas, and verify the documentation build once on Ubuntu pull-request CI. Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Cover plural dynamic-suffix examples and deprecations missing required status in Zod/AJV parity checks. Remove whitespace found by final diff verification. Refs GH-512 Co-Authored-By: Cursor <cursoragent@cursor.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Assert the expected Zod and AJV results for plural dynamic examples and deprecations missing status so agreement on incorrect behavior fails. Refs GH-512 Co-Authored-By: Cursor <cursoragent@cursor.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Preserve actionable validation paths, legacy schema anchors, and authoring metadata while making parity fixtures assert explicit semantics. Refs #512 Co-Authored-By: Cursor <cursoragent@cursor.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Cover the remaining nested and top-level strict-object failures with explicit false oracles for both Zod and AJV. Refs #512 Co-Authored-By: Cursor <cursoragent@cursor.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Attributes
Other
Internal Changes 🔧Attribute
Attributes
Deps
Other
🤖 This preview updates automatically when you update the PR. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7dbadc9. Configure here.
Keep committed JSON Schemas readable by inlining anonymous reused nodes while preserving explicitly named compatibility definitions. Refs #512 Co-Authored-By: Claude <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
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.

Make Zod 4 the single hand-written definition for all six model document formats. TypeScript input types are now inferred from those schemas, while the existing Draft 7 files remain committed, deterministically generated compatibility artifacts.
This removes drift between JSON Schema, Astro's embedded Zod definitions, and
scripts/types.ts. Code generation and maintenance scripts now validate JSON before use and report actionable paths, and Astro consumes the same canonical schemas. Generated schemas preserve legacy anchors and authoring descriptions for existing external consumers.We considered keeping JSON Schema canonical and generating Zod, but translating the existing conditional rules into useful Astro schemas would add another fragile generation layer. A staged migration was also considered; landing the consumers and parity checks together prevents an intermediate period with competing sources of truth.
The generated attribute schema is structurally larger because type/example relationships are represented as explicit unions. Reviewers should pay particular attention to the generated-schema compatibility wrappers and the explicit Zod/AJV semantic-oracle tests.
Fixes #512
Made with Cursor