swagger-api / swagger-api/swagger-codegen

Broken typescript-angular default.service.ts

Open
#9,163 6 comments 4 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

The generated angular file default.service.ts uses wrong import path delimiters on windows installation.
import { UpdateInfo } from '../model\updateInfo';
Most propably it is using windows path seperator while doing path concatenation, what is not correct way how angular import path should be constructed.

Expected value is import { UpdateInfo } from '../model/updateInfo';

The generated file has also missing } bracket before EOF.

There is missing body parameter in generated post method:
return this.httpClient.post(${this.basePath}/someurl,
body, ---is missing in generated code
{ ....

The import path issue is also in generated api.module.ts containing
import { DefaultService } from './api\default.service';

The generation was invoked by swager-codegen-cli with parameter -l typescript-angular

Swagger-codegen version

3.0.rc2 and 3.0.4

Swagger declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

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 with the typescript-angular generation entry point used by swagger-codegen-cli and compare the generated default.service.ts and api.module.ts shown in the report. Verify the path separators, missing closing brace, and post body parameter against the expected output; done means regenerated files are valid TypeScript with the reported corrections.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.