fix(codegen): collect input types referenced by table field arguments#1202
Merged
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
fc09b0f to
62061ea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Split from #1200 (Issue 1 only), rewritten with an improved approach.
Problem: Input types referenced only by table-field arguments (e.g.
FooBulkUploadFileInputon bucket computed fields likerequestBulkUploadUrls(files: [FooBulkUploadFileInput!]!)) were inlined into*Selecttypes viatypeRefToTsbut never registered for generation — leaving the referenced Input interfaces undefined in the output.Approach (differs from #1200): Instead of adding a standalone
collectFieldArgInputTypesfunction as a third parallel collector, this extends the existingcollectInputTypeNames()to optionally accepttablesand 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:
index.ts): passestablestocollectInputTypeNames(allOps, tables)so field-arg types flow through the normal pipelinegenerateInputTypesFile: also merges field-arg types internally, so direct callers (including tests) get correct behavior without needing to pre-collectFiles changed:
graphql/codegen/src/core/codegen/orm/input-types-generator.ts— extendedcollectInputTypeNamessignature + defense-in-depth mergegraphql/codegen/src/core/codegen/orm/index.ts— passestablestocollectInputTypeNamesgraphql/codegen/src/__tests__/codegen/input-types-generator.test.ts— 2 regression tests (end-to-end generation + unit test ofcollectInputTypeNames)Review & Testing Checklist for Human
BulkUploadFileInputtypes appear in generated outputNotes
This replaces the original #1200 Issue 1 implementation. The key difference: no new standalone function — just extends the existing
collectInputTypeNameswith an optionaltablesparameter, following the principle of one collection path rather than parallel collectors.Link to Devin session: https://app.devin.ai/sessions/11c358ec8678488eba3255c53f3e440f
Requested by: @pyramation