Skip to content

fix(codegen): emit INPUT_OBJECT types nested inside CRUD entity inputs#1286

Merged
pyramation merged 1 commit into
mainfrom
fix/codegen-missing-input-types
Jun 11, 2026
Merged

fix(codegen): emit INPUT_OBJECT types nested inside CRUD entity inputs#1286
pyramation merged 1 commit into
mainfrom
fix/codegen-missing-input-types

Conversation

@pyramation

Copy link
Copy Markdown
Contributor

Summary

Fixes a codegen bug where INPUT_OBJECT types referenced by CRUD entity input fields were never emitted in input-types.ts, causing downstream TypeScript build failures.

Example: PlatformFunctionDefinition has requiredConfigs: [FunctionRequirementInput]. The CRUD generator inlines this as a type string in CreatePlatformFunctionDefinitionInput, but FunctionRequirementInput was never generated as an interface — only FunctionRequirement was emitted as type FunctionRequirement = unknown (custom scalar alias).

Root cause in generateInputTypesFile: collectInputTypeNames only scans operation args and table field args. The CRUD path (buildCreateDataFieldsFromSchema) reads entity input fields via typeRefToTs → returns type name strings, but nobody collects those referenced input types for generation.

+ // in generateInputTypesFile, after collecting field arg types:
+ const crudNestedTypes = collectCrudNestedInputTypes(tablesList, typeRegistry);
+ for (const typeName of crudNestedTypes) {
+   mergedUsedInputTypes.add(typeName);
+ }

New collectCrudNestedInputTypes() walks each table's Create*Input and *Patch entity input fields, recursively collecting any INPUT_OBJECT types found. These are merged into mergedUsedInputTypes so generateCustomInputTypes emits them.

All 358 existing tests pass + 2 new tests covering collection and full output generation.

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

When a table's Create/Patch entity input contains fields referencing
non-scalar INPUT_OBJECT types (e.g. requiredConfigs: [FunctionRequirementInput]),
the ORM input-types generator would inline the type name as a string but never
generate its interface definition. This caused TypeScript build failures in
downstream SDK packages.

Root cause: collectInputTypeNames only scanned operation args and table field
args, not the fields inside CRUD entity input types (CreateXInput → XInput →
nested input types).

Fix: adds collectCrudNestedInputTypes() which traverses Create/Patch entity
input fields recursively and collects any referenced INPUT_OBJECT types,
merging them into the custom input types generation pass.

Adds two tests covering the collection and full output generation.
@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, CI, and merge conflict monitoring

@pyramation pyramation merged commit 5e05411 into main Jun 11, 2026
36 checks passed
@pyramation pyramation deleted the fix/codegen-missing-input-types branch June 11, 2026 09:23
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