[typescript-nestjs-server] Fix imports for numbered inline models

DO
1d ago
+41-3

Fixes #25711.

With two inline object alternatives in a oneOf, the NestJS server generator writes overlap-one-of-1.ts but imports ./overlap-one-of1. On master (a8f08266), compiling the generated model index with TypeScript 5.7.3 fails with TS2307.

Use the referenced model's recorded classFilename for the import. This preserves the existing output paths and keeps the existing naming fallback for imports outside the generated model set. The regression test generates both inline alternatives, checks that the numbered file exists, and verifies its import.

Verification

  • The regression test failed on master and passed with the fix.
  • Built the CLI and ran the TypeScript test group: 243 passed, 2 skipped.
  • tsc --noEmit passed on the generated model index with kebab-case, camelCase, and custom model and file suffixes.
  • Regenerated both NestJS server sample configurations and the generator reference in WSL. All three matched the checked-in files.

PR checklist

  • Read the contribution guidelines.
  • Built the project and regenerated the affected samples and generator documentation.
  • Mention technical committee members.

Prepared with OpenAI Codex.


Summary by cubic

Fixes NestJS server imports for numbered inline models so generated TypeScript compiles without TS2307.

With two inline object alternatives in a oneOf, the generator emits overlap-one-of-1.ts but imports ./overlap-one-of1, breaking compilation. The import now uses the referenced model's recorded classFilename, preserving existing output paths and keeping the old naming fallback for models outside the generated set.

Verification

  • Regression test fails on master and passes with the fix.
  • TypeScript test group passes: 243 passed, 2 skipped.
  • tsc --noEmit passes on generated model indexes with kebab-case, camelCase, and custom model and file suffixes.
  • NestJS server samples and the generator reference match after regeneration.