Skip to content

fix(codegen): collect input types referenced by table field arguments#1202

Merged
pyramation merged 1 commit into
mainfrom
fix/codegen-bulk-upload-input-types
May 20, 2026
Merged

fix(codegen): collect input types referenced by table field arguments#1202
pyramation merged 1 commit into
mainfrom
fix/codegen-bulk-upload-input-types

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

@pyramation pyramation commented May 20, 2026

Summary

Split from #1200 (Issue 1 only), rewritten with an improved approach.

Problem: Input types referenced only by table-field arguments (e.g. FooBulkUploadFileInput on bucket computed fields like requestBulkUploadUrls(files: [FooBulkUploadFileInput!]!)) were inlined into *Select types via typeRefToTs but never registered for generation — leaving the referenced Input interfaces undefined in the output.

Approach (differs from #1200): Instead of adding a standalone collectFieldArgInputTypes function as a third parallel collector, this extends the existing collectInputTypeNames() to optionally accept tables and scan their computed-field args. This keeps one function and one code path for all input type collection from args.

The fix is applied at two levels for defense-in-depth:

  1. Orchestrator (index.ts): passes tables to collectInputTypeNames(allOps, tables) so field-arg types flow through the normal pipeline
  2. generateInputTypesFile: also merges field-arg types internally, so direct callers (including tests) get correct behavior without needing to pre-collect

Files changed:

  • graphql/codegen/src/core/codegen/orm/input-types-generator.ts — extended collectInputTypeNames signature + defense-in-depth merge
  • graphql/codegen/src/core/codegen/orm/index.ts — passes tables to collectInputTypeNames
  • graphql/codegen/src/__tests__/codegen/input-types-generator.test.ts — 2 regression tests (end-to-end generation + unit test of collectInputTypeNames)

Review & Testing Checklist for Human

  • Run codegen against a schema with bucket tables and verify the BulkUploadFileInput types appear in generated output
  • Verify no duplicate type declarations when a field-arg type is also referenced by a custom operation

Notes

This replaces the original #1200 Issue 1 implementation. The key difference: no new standalone function — just extends the existing collectInputTypeNames with an optional tables parameter, following the principle of one collection path rather than parallel collectors.

Link to Devin session: https://app.devin.ai/sessions/11c358ec8678488eba3255c53f3e440f
Requested by: @pyramation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Extend collectInputTypeNames() to optionally accept tables and scan
their computed-field args for Input/Filter type references. This handles
bucket-style computed fields (e.g. requestBulkUploadUrls) whose arg
types were inlined into *Select types but never registered for
generation.

The fix is applied at two levels:
- In the orchestrator (index.ts): passes tables to collectInputTypeNames
- In generateInputTypesFile: defense-in-depth merge for direct callers

Includes regression tests for both the end-to-end generation and the
collectInputTypeNames function itself.
@devin-ai-integration devin-ai-integration Bot force-pushed the fix/codegen-bulk-upload-input-types branch from fc09b0f to 62061ea Compare May 20, 2026 19:27
@pyramation pyramation merged commit bbff0e3 into main May 20, 2026
38 checks passed
@pyramation pyramation deleted the fix/codegen-bulk-upload-input-types branch May 20, 2026 20:19
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