swagger-api / swagger-api/swagger-codegen

[Typescript-Angular] Client code does not compile (missing mapstringobject.ts)

Open
#9,245 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Bug report

The client code generated for typescript-angular has errors and it does not compile, there is a missing file / class / interface called in the model. This can be manually fixed by creating a file like this:

/model/mapstringobject.ts

export interface Mapstringobject {
[key: string]: any;
}

The client code has been generated with last version of swagger-codegen command. The originating backend code is a Spring MVC application.

Command line used for generation

Error in ng build:

BUILD ERROR
projects/horus-api-lib/src/lib/api/menuController.service.ts(21,33): error TS2307: Cannot find module '../model/mapstringobject'.

Error: projects/horus-api-lib/src/lib/api/menuController.service.ts(21,33): error TS2307: Cannot find module '../model/mapstringobject'.

    at Object.<anonymous> (D:\HORUS\workspace_web_upgrade\horus-api-lib-spa\node_modules\ng-packagr\lib\ngc\compile-source-files.js:65:19)
    at Generator.next (<anonymous>)
    at fulfilled (D:\HORUS\workspace_web_upgrade\horus-api-lib-spa\node_modules\ng-packagr\lib\ngc\compile-source-files.js:4:58)
    at <anonymous>

projects/horus-api-lib/src/lib/api/menuController.service.ts(21,33): error TS2307: Cannot find module '../model/mapstringobject'.

Error: projects/horus-api-lib/src/lib/api/menuController.service.ts(21,33): error TS2307: Cannot find module '../model/mapstringobject'.

    at Object.<anonymous> (D:\HORUS\workspace_web_upgrade\horus-api-lib-spa\node_modules\ng-packagr\lib\ngc\compile-source-files.js:65:19)
    at Generator.next (<anonymous>)
    at fulfilled (D:\HORUS\workspace_web_upgrade\horus-api-lib-spa\node_modules\ng-packagr\lib\ngc\compile-source-files.js:4:58)
    at <anonymous>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported ng build failure and inspect projects/horus-api-lib/src/lib/api/menuController.service.ts, especially its import of ../model/mapstringobject. Trace the typescript-angular generation output to determine why the referenced model is absent. Done means the generated client includes the required model and ng build completes without the TS2307 error.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
api, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.