Skip to content

fix: resolve NestJS GraphQL decorator parsing issue#61

Merged
zerochae merged 1 commit intomasterfrom
fix/nestjs-graphql-decorator-parsing
Oct 10, 2025
Merged

fix: resolve NestJS GraphQL decorator parsing issue#61
zerochae merged 1 commit intomasterfrom
fix/nestjs-graphql-decorator-parsing

Conversation

@zerochae
Copy link
Copy Markdown
Owner

Fix bug where @Query/@mutation decorators without options object were not being detected:

  • @query(() => [Type]) now works correctly
  • @mutation(() => Type) now works correctly

The issue was that decorators ending with ')' were incorrectly identified as "decorator only" and returning nil. Now they are treated as incomplete decorators that need extended content to find the function name.

Add test cases for both patterns:

  • @query without options on same line
  • @query with options starting on same line

Fix bug where @Query/@mutation decorators without options object
were not being detected:
- @query(() => [Type]) now works correctly
- @mutation(() => Type) now works correctly

The issue was that decorators ending with ')' were incorrectly
identified as "decorator only" and returning nil. Now they are
treated as incomplete decorators that need extended content
to find the function name.

Add test cases for both patterns:
- @query without options on same line
- @query with options starting on same line

Fixes Reddit user gi4c0's reported issue
@zerochae zerochae merged commit 7d4630f into master Oct 10, 2025
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.

1 participant