Skip to content
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

fix(generator): Nullability of JSON field is reversed #240

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nordowl
Copy link

@nordowl nordowl commented Feb 1, 2024

Fixes #238

Tested locally with a simple schema:

model User {
  id String @unique
  name String
  bio Json
}

model UserOptional {
  id String @unique
  name String?
  bio Json?
}

now correctly generates

export const UserSchema = z.object({
  id: z.string(),
  name: z.string(),
  bio: JsonValueSchema,
})

export const UserOptionalSchema = z.object({
  id: z.string(),
  name: z.string().nullable(),
  bio: JsonValueSchema.nullable(),
})

@nordowl nordowl changed the title fix(generator): Nullable JSON field is reversed fix(generator): Nullability of JSON field is reversed Feb 1, 2024
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

Successfully merging this pull request may close these issues.

[BUG] nullable is reversed on json type
1 participant