Skip to content

[Feature Request] Partially typed JSON fields #2100

Open
@daaain

Description

@daaain

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions