Skip to content

feat(graphql): support explicit args type names#4024

Open
xudongcc wants to merge 1 commit into
nestjs:v14.0.0from
xudongcc:args-type-explicit-name
Open

feat(graphql): support explicit args type names#4024
xudongcc wants to merge 1 commit into
nestjs:v14.0.0from
xudongcc:args-type-explicit-name

Conversation

@xudongcc

@xudongcc xudongcc commented Jun 2, 2026

Copy link
Copy Markdown

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

@ObjectType() and @InputType() support explicit GraphQL type names through @ObjectType(name, options?) and @InputType(name, options?), but @ArgsType() only accepts ArgsTypeOptions and always uses the TypeScript class name for metadata.

Issue Number: #4023

What is the new behavior?

@ArgsType() now supports the same explicit-name overload shape:

@ArgsType()
@ArgsType(options)
@ArgsType(name, options?)

The implementation follows the existing ObjectType and InputType decorator pattern, preserving ArgsTypeOptions such as registerIn and falling back to target.name when no explicit name is provided. The browser/react-native model shim accepts the same arguments.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Verified with:

COREPACK_ENABLE_PROJECT_SPEC=0 corepack yarn workspace @nestjs/graphql test:e2e tests/decorators/register-in.decorator.spec.ts
COREPACK_ENABLE_PROJECT_SPEC=0 corepack yarn build
COREPACK_ENABLE_PROJECT_SPEC=0 corepack yarn lint
COREPACK_ENABLE_PROJECT_SPEC=0 corepack yarn format --check
git diff --check

@kamilmysliwiec

Copy link
Copy Markdown
Member

could you target this #3973 branch?

@xudongcc xudongcc changed the base branch from master to v14.0.0 June 17, 2026 06:27
@xudongcc xudongcc force-pushed the args-type-explicit-name branch from 3378cd3 to f8da599 Compare June 17, 2026 06:34
@xudongcc

Copy link
Copy Markdown
Author

could you target this #3973 branch?

@kamilmysliwiec Thanks! I've retargeted this PR to the v14.0.0 branch and rebased it. The conflict is resolved and CI is green now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants