Skip to content

[Feature Request] Partially typed JSON fields #2100

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

Open
daaain opened this issue Apr 29, 2025 · 0 comments
Open

[Feature Request] Partially typed JSON fields #2100

daaain opened this issue Apr 29, 2025 · 0 comments

Comments

@daaain
Copy link

daaain commented Apr 29, 2025

Is your feature request related to a problem? Please describe.
Currently, when creating a typed JSON field, every possible field needs to be specified, otherwise Validation error: Unrecognized key(s) in object. will be thrown.

Describe the solution you'd like
This makes incremental typing impossible, where some fields would be typed, but any other field would still be accepted.

So I'd like to propose a flag that loosens the Zod type check so that setting the typed JSON column is possible with a partially typed value, where all specified properties must be valid, but further unspecified properties are accepted.

Describe alternatives you've considered
Since this is a schema feature, I don't think there's a simple workaround. I had to spend a fair bit of time migrating a big metadata field that is currently used as a bit of dumping ground until we figure out what's exactly needed.

Additional context
I also had to leave some deeper properties as untyped JSON to prevent further issues, even though I do know what are some of the expected properties.

@daaain daaain changed the title Partially typed JSON fields [Feature Request] Partially typed JSON fields Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant