Add support for Postgres arrays mapped to JSON#41
Merged
elledienne merged 3 commits intomainfrom Jun 29, 2025
Merged
Conversation
Zero doesn't natively support Postgres arrays, but they can be stored as JSON. This change extends the generator to detect array fields (string[], int[], etc.) and map them to json<type[]>() in the Zero schema while preserving TypeScript type safety. Changes: - Remove filter that excluded array fields from schema generation - Map array types to json<T[]>() in typeMapper (e.g., json<string[]>()) - Support all Prisma array types: String[], Int[], Float[], Boolean[], DateTime[], etc. - Support enum arrays: MyEnum[] - Handle optional arrays and database column mapping - Add comprehensive test coverage for array support 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add new section explaining how arrays are mapped to JSON - Include examples of Prisma schema with arrays and generated Zero schema - Document all supported array types (scalar, enum, optional) - Remove outdated note about array exclusion - Update package description to mention array support 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.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.
Summary
json<type[]>()syntax for proper TypeScript type safetyExample