prisma-nestjs-graphql icon indicating copy to clipboard operation
prisma-nestjs-graphql copied to clipboard

[Question] InputType() decorator additional configuration (name)

Open nyatskiv opened this issue 2 years ago • 1 comments

Hi! I would like to solve one problem and here is a context.

I am using Apollo Federation and we have multiple subgraphs. Some of them will use Postgres and others will use Mongo. This plugin is wonderful and saved us a lot of time. This time I seek for a solution to this specific problem.

  • If the database is Postrgres -> InputType JsonNullableFilter has one definition
  • If the database is Mongo -> InputType JsonNullableFilter has another definition

In conclusion -> Supergraph Composition fails because it cannot build two different input types.

Problem:

I have this piece of code that is generated depending on provider

@ InputType() export class JsonNullableFilter { field a, field b }

@ InputType() export class JsonNullableFilter { field c, field d }

Question:

  • Is there a possibility to modify @InputType() decorator (via configuration for example) to @InputType('something')

Ideally:

  • I want to have

@ InputType('PostgresJsonNullableFilter') export class JsonNullableFilter { field a, field b }

@ InputType('MongoJsonNullableFilter') export class JsonNullableFilter { field c, field d }

Screenshot 2023-05-31 at 08 03 01 Screenshot 2023-05-31 at 08 03 15

nyatskiv avatar May 31 '23 05:05 nyatskiv

JsonNullableFilter is a built-in type, it's possible to add such feature, it requires add new code

unlight avatar Jun 03 '23 16:06 unlight