-
-
Couldn't load subscription status.
- Fork 10
Update to Zod 4 #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to Zod 4 #164
Conversation
Version published 🚀npm install @alveusgg/[email protected]pnpm add @alveusgg/[email protected] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the codebase to use Zod version 4, refactoring various schemas and validators accordingly to align with the new API.
- Update imports from "zod" to "zod/v4".
- Replace custom validations with Zod's custom schemas for partial date strings, IUCN statuses, enclosure keys, species keys, positions, and classifications.
- Bump the package version and update the Zod peer dependency.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/types.ts | Introduces partialDateStringSchema using z.custom |
| src/iucn.ts | Adds iucnStatusSchema with enhanced error messaging |
| src/enclosures.ts | Exports enclosureKeySchema for validating keys |
| src/ambassadors/species.ts | Replaces string refinements with schema references; renames isSpecies to isSpeciesKey and adds speciesKeySchema |
| src/ambassadors/images.ts | Refactors image schema to use a custom position schema |
| src/ambassadors/core.ts | Updates ambassadorSchema to use new schema references |
| src/ambassadors/classification.ts | Introduces classSchema using z.custom |
| package.json | Bumps version and updates the Zod dependency |
Comments suppressed due to low confidence (1)
src/iucn.ts:42
- The error message references 'iucnFlags', but there is no indication that 'iucnFlags' is defined or imported. Please ensure that 'iucnFlags' is declared or imported where needed.
`must be a valid IUCN status (${Object.keys(iucnStatuses).join(", ")} [optionally suffixed with /${Object.keys(iucnFlags).join(", /")])`,
Resolves #158