Skip to main content
Version: 3.0 Beta

Strongly Typed JSON

🔋 ZenStack vs Prisma

Strongly typed JSON is a ZModel feature and doesn't exist in Prisma.

ZModel allows you to define custom types and use them to type JSON fields. The ORM respects such fields in two ways:

  1. The return type of such fields is typed as TypeScript types derived from the ZModel custom type definition.
  2. When creating or updating such fields, the ORM validates the input against the custom type definition. The engine "loosely" validates the mutation input and doesn't prevent you from including fields not defined in the custom type.

Samples​

zenstack/schema.zmodel
Loading...
main.ts
Loading...
Comments
Feel free to ask questions, give feedback, or report issues.

Don't Spam


You can edit/delete your comments by going directly to the discussion, clicking on the 'comments' link below