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
Hi, I am trying to add Json and DateTime scalar types in the type definitions, but I am getting an error [ERROR] 16:40:30 Error: Json was already defined and imported as a type, check the docs for extending types.
Here's how I am adding the Json and DateTime...
import { objectType, arg, intArg, stringArg, inputObjectType, enumType } from 'nexus';
import { GraphQLScalarType } from 'graphql';
import { JSONResolver, DateTimeResolver } from 'graphql-scalars';
import { asNexusMethod } from 'nexus';
export const Json = asNexusMethod(
new GraphQLScalarType({
...JSONResolver,
// Override the default 'JsonObject' name with one that matches what Nexus Prisma expects.
name: 'Json',
}),
'json',
);
export const DateTime = asNexusMethod(new GraphQLScalarType(DateTimeResolver), 'dateTime');
export const Asn = objectType({
name: "Asn",
definition(t) {
t.nonNull.id("id")
t.nonNull.string("asnID")
t.nonNull.string("description")
t.string("comment")
t.field("language", { type: Language })
t.field("data", { type: Json })
t.nonNull.field("createdAt", { type: DateTime })
t.nonNull.field("updatedAt", { type: DateTime })
}
})
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I am trying to add Json and DateTime scalar types in the type definitions, but I am getting an error [ERROR] 16:40:30 Error: Json was already defined and imported as a type, check the docs for extending types.
Here's how I am adding the Json and DateTime...
Beta Was this translation helpful? Give feedback.
All reactions