Skip to content

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

Open
DOKL57 wants to merge 1 commit into
OpenAPITools:masterfrom
DOKL57:fix/nestjs-numbered-model-imports
Open

DOKL57 wants to merge 1 commit into
OpenAPITools:masterfrom
DOKL57:fix/nestjs-numbered-model-imports

Conversation

@DOKL57

@DOKL57 DOKL57 commented Nov 19, 2026 •

Copy link
Copy Markdown

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.

Written for commit 2f97eae. Summary will update on new commits.

View guided diff

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

View guided diff | Re-trigger cubic

@thekhegay thekhegay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

This branch has not been deployed

No deployments
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.

[BUG][typescript-nestjs-server] kebab-case import path of numbered inline model does not match its file name (TS2307)

2 participants