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

Maps JSON GraphQL Scalars to Prisma Json field types for compatibility #5796

Merged
merged 5 commits into from Jun 21, 2022

Conversation

dthyresson
Copy link
Contributor

Fixes #5667

For an example of how the JSON scalar used in the SDL causes a type incompatibility with Prisma, see #5667

In Prisma, the Json field supports a few additional types, such as string and boolean. These additional types exist to match the types supported by JSON.parse().

export declare type JsonValue =
  | string
  | number
  | boolean
  | null
  | JsonObject
  | JsonArray

This PR imports Prisma and maps

    JSON: 'Prisma.JsonValue',
    JSONObject: 'Prisma.JsonObject',

@netlify
Copy link

netlify bot commented Jun 21, 2022

Deploy Preview for redwoodjs-docs canceled.

Name Link
🔨 Latest commit 104ff9c
🔍 Latest deploy log https://app.netlify.com/sites/redwoodjs-docs/deploys/62b227932ffdaa00089b07b1

@dthyresson dthyresson marked this pull request as ready for review June 21, 2022 18:48
@dac09 dac09 enabled auto-merge (squash) June 21, 2022 20:18
@dac09 dac09 merged commit 4342d69 into redwoodjs:main Jun 21, 2022
@redwoodjs-bot redwoodjs-bot bot added this to the next-release milestone Jun 21, 2022
dac09 added a commit to dac09/redwood that referenced this pull request Jun 23, 2022
…ctmode-gen

* 'main' of github.com:redwoodjs/redwood:
  validateUniquess optional prismaClient parameter (redwoodjs#5763)
  fix(deps): update dependency prettier to v2.7.1 (redwoodjs#5808)
  fix(deps): update dependency eslint to v8.18.0 (redwoodjs#5806)
  fix(deps): update dependency systeminformation to v5.11.21 (redwoodjs#5805)
  fix(deps): update dependency @apollo/client to v3.6.9 (redwoodjs#5804)
  chore(deps): update dependency firebase to v9.8.3 (redwoodjs#5799)
  Add Azure AD B2C auth provider compatibility (redwoodjs#5781)
  chore(deps): update dependency esbuild to v0.14.47 (redwoodjs#5798)
  Maps JSON GraphQL Scalars to Prisma Json field types for compatibility (redwoodjs#5796)
  fix(deps): update prisma monorepo to v3.15.2 (redwoodjs#5789)
  fix(deps): update dependency core-js to v3.23.2 (redwoodjs#5790)
  fix(deps): update dependency webpack to v5.73.0 (redwoodjs#5755)
  docs: update disable api layer/database to include disabling prisma (redwoodjs#5528)
  Fix typo in testing docs (redwoodjs#5782)
  fix typo (redwoodjs#5777)
  docs: Replacing Prisma.xxx types with types from 'types/graphql' (redwoodjs#5740)
  Reorganize auth docs into sub-categories (redwoodjs#5787)
@jtoar jtoar modified the milestones: next-release, v2.1.0 Jul 5, 2022
@dac09
Copy link
Collaborator

dac09 commented Jul 6, 2022

@dthyresson I've found an issue with the change we made here. I think we'll need to tweak how we do this slightly

It looks like it tries to add the Prisma namespace as a mapped type here, because we configure it in the type mappers:
Screenshot 2022-07-06 at 11 48 11

@dthyresson
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix This PR is a fix
Projects
Status: Archived
Development

Successfully merging this pull request may close these issues.

Incompatible types generated for JSON field in Prisma and GraphQL
3 participants