You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Json scalar was added in the pull request [#9] but it uses the JSONObjectResolver from graphql-scalars which only support JSON objects. This is a problem because databases JSON datatypes, such as of Postgres, allow other types of serializable JSON data such as arrays, strings, etc. And if the value in a JSON column doesn't represent a JSON object prisma will crash.
Ideas / Proposed Solution(s)
To work around this, I had to override the Json scalar to use JSONResolver like this:
import{GraphQLScalarType}from'graphql'import{JSONResolver}from'graphql-scalars'// Overrides Json scalar to use JSONResolver instead of JSONObjectResolver// which doesn't support arrays and other JSON serializable values.NexusPrismaScalars.Json=newGraphQLScalarType({
...JSONResolver,name: 'Json',})
The sollution would be changing the Json scalar provided by nexus-prisma to use JSONResolver instead of JSONObjectResolver.
I believe making this change will be backwards compatible since JSONResolver also support objects.
The text was updated successfully, but these errors were encountered:
Perceived Problem
The
Json
scalar was added in the pull request [#9] but it uses theJSONObjectResolver
fromgraphql-scalars
which only support JSON objects. This is a problem because databases JSON datatypes, such as of Postgres, allow other types of serializable JSON data such as arrays, strings, etc. And if the value in a JSON column doesn't represent a JSON object prisma will crash.Ideas / Proposed Solution(s)
To work around this, I had to override the Json scalar to use
JSONResolver
like this:The sollution would be changing the
Json
scalar provided bynexus-prisma
to useJSONResolver
instead ofJSONObjectResolver
.I believe making this change will be backwards compatible since
JSONResolver
also support objects.The text was updated successfully, but these errors were encountered: