lolopinto / ent

MIT License
51 stars 6 forks source link

Can't rename Input Object #1755

Closed ashleyxue529 closed 6 months ago

ashleyxue529 commented 8 months ago

Related to the prior issue, trying to rename my input type using name, but I'm not sure if codegen recognizes it, or not sure what I'm doing wrong.

Error:

template: render_args.tmpl:10:26: executing "render_args.tmpl" at <useImport $import.Import>: error calling useImport: tried to use import CreateObjectInput at path src/graphql/generated/mutations/create_object_type.ts even though it was never reserved

Setup

@gqlInputObjectType({
  name: "CustomNameInput",
}) 
export class CustomNameInput { ... }

export class CreateObjectResolver {
  @gqlMutation({
    class: "CreateObjectResolver",
    name: "createObject",
    type: CreateObjectPayload,
    async: true,
    args: [
      gqlContextType(),
      {
        name: "input",
        type: "CustomNameInput",  // Works fine if I use/name with CreateObjectInput
      },
    ],
  })
  async createCart(
    context: RequestContext,
    input: CustomNameInput,
  ): Promise<CreateObjectPayload> {
    return new CreateObjectPayload();
  }
}
lolopinto commented 8 months ago

presumably ->

export class CustomNameInput { ... }

should be

export class CreateObjectInput { ... }

?

ashleyxue529 commented 8 months ago

i think at the time i was trying to rename the input from CreateObjectInput -> CustomNameInput, but is CreateObjectInput not intended to change? if so we can just close this as its not a blocker, just something i thought behaved differently than i expected

lolopinto commented 8 months ago

The rename is supposed to be supported and partly works but the implementation is incomplete.

On Fri, Mar 1, 2024 at 18:21 Ashley Xue @.***> wrote:

i think at the time i was trying to rename the input from CreateObjectInput -> CustomNameInput, but is CreateObjectInput not intended to change? if so we can just close this as its not a blocker, just something i thought behaved differently than i expected

— Reply to this email directly, view it on GitHub https://github.com/lolopinto/ent/issues/1755#issuecomment-1974203007, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACS2VN4EWDUPIG4QLHKUMSTYWEZR3AVCNFSM6AAAAABDM6EVUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZUGIYDGMBQG4 . You are receiving this because you commented.Message ID: @.***>