rogerballard / nestjs-relay

A batteries-included toolkit for building Relay-compliant GraphQL APIs with NestJS v7
MIT License
58 stars 14 forks source link

Allows use of ResolvedGlobalId with class-transformer library #221

Open JimAllanson opened 2 years ago

JimAllanson commented 2 years ago

The ResolvedGlobalId class currently requires constructor parameters. This causes an error when used with the class-transformer library, as this library attempts to initialise classes without contructor arguments, setting properties individually afterwards. This causes an issue when trying to use a ResolvedGlobalId as an argument, e.g.

async resolveNode( resolvedGlobalId: ResolvedGlobalId){...

Making this parameter optional allows it to work correctly with the class-transformer library while maintaining the current custom scalar logic.