Closed steida closed 5 years ago
Add
export const GQLMax140Chars = asNexusMethod(
new RegularExpression('Max140Chars', /[\s\S]{0,140}/),
'max140Chars',
);
export const GQLMax1024Chars = asNexusMethod(
new RegularExpression('Max1024Chars', /[\s\S]{0,1024}/),
'Max1024Chars',
);
Ups. Relay does not support custom scalars mapping. That's bad.
But we can fix 'any' type generated with Relay manually via mapped types. OK, that's good enough. API integrity is the must.
But Nexus has the same problem. It generates any type for any custom scalar. That sucks. OK, use default scalars until both Nexus and Relay will support custom scalar TS types generation.
Oh, Nexus supports custom mapping.
typegenAutoConfig: {
// debug: true,
sources: [{ source: path.join(__dirname, './types.ts'), alias: 'types' }],
contextType: 'types.Context',
backingTypeMap: {
EmailAddress: 'string',
},
},
Hmm, but Relay does not support it yet and useMutation leverages types for input component fields.
But we can patch it!
Low priority, but having restricted GraphQL types would be nice.
Sunsetting.
https://github.com/okgrow/graphql-scalars
Integration to Nexus is 👌