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

Json types inside type declarations won't work #303

Closed
2 tasks done
thomasbouillon opened this issue Apr 16, 2024 · 1 comment · Fixed by #389
Closed
2 tasks done

Json types inside type declarations won't work #303

thomasbouillon opened this issue Apr 16, 2024 · 1 comment · Fixed by #389
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@thomasbouillon
Copy link

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Versions

v3.0.4

A minimal reproducible example

https://github.com/thomasbouillon/reproduce-prisma-json-issue

Description

The README says Json types inside type declarations won't work but the linked issue has been resolved and merged since prisma 4.16.0.

Now it should work ?

(using mongodb if that changes anything)

Steps to Reproduce

schema.prisma

model A {
    nested B
}

type B {
   /// [CustomJson]
   myJsonValue Json
}
yarn prisma generate

Result:

... 
{
       /**
       * [CustomJson]
       */
      myJsonValue: Prisma.JsonValue
}

Expected Behavior

schema.prisma

model A {
    nested B
}

type B {
   /// [CustomJson]
   myJsonValue Json
}
yarn prisma generate

Result:

... {
       /**
       * [CustomJson]
       */
      myJsonValue: PrismaJson.CustomJson  //  <-----
}
@arthurfiorette arthurfiorette self-assigned this Apr 16, 2024
@arthurfiorette arthurfiorette added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Apr 16, 2024
@arthurfiorette
Copy link
Owner

Hey @thomasbouillon, thanks for this bug report. Since then I didn't implemented and/or testes support for json inside prisma types. Are you open to PR it? remember to add unit tests...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants