Skip to content

[BUG] @json for List type does not support optional typing or default of empty list #2046

@Tsimopak

Description

@Tsimopak

I try to declare the following typing:

discussions Discussion[]? @json

But I get an error that: Optional lists are not supported. Use either Type[] or Type?.

Then I tried to do:

discussions Discussion[] @json @default([])

But when I try to zenstack generate I get an error:

Value is not assignable to parameter.

And If I just leave it without a default value and not without optional mark and try to make an instance it asks for it.

Environment:

  • ZenStack version: 2.12.3
  • Prisma version: 6.5
  • Database type: Postgresql

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