swagger-api / swagger-api/swagger-codegen

[Typescript-Angular] Client code does not compile (missing braces)

Open
#9,228 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 are closing braces missing in some files. To make it work you have to manually edit the files.

Swagger-codegen version

Swagger Hub

Swagger declaration file content or url

Find attached the api definition in yml:

openapi.zip

Code generated with Swagger Hub:

typescript-angular-client-generated.zip

Command line used for generation

Error in ng build:

BUILD ERROR
diary-shit-client-lib/src/lib/api/diary.service.ts(229,1): error TS1005: '}' expected.

Error: diary-shit-client-lib/src/lib/api/diary.service.ts(229,1): error TS1005: '}' expected.

    at Object.<anonymous> (D:\DANI\vscode\dairy-shit-libs\node_modules\ng-packagr\lib\ngc\compile-source-files.js:65:19)
    at Generator.next (<anonymous>)
    at fulfilled (D:\DANI\vscode\dairy-shit-libs\node_modules\ng-packagr\lib\ngc\compile-source-files.js:4:58)
    at <anonymous>

diary-shit-client-lib/src/lib/api/diary.service.ts(229,1): error TS1005: '}' expected.

Error: diary-shit-client-lib/src/lib/api/diary.service.ts(229,1): error TS1005: '}' expected.

    at Object.<anonymous> (D:\DANI\vscode\dairy-shit-libs\node_modules\ng-packagr\lib\ngc\compile-source-files.js:65:19)
    at Generator.next (<anonymous>)
    at fulfilled (D:\DANI\vscode\dairy-shit-libs\node_modules\ng-packagr\lib\ngc\compile-source-files.js:4:58)
    at <anonymous>
Steps to reproduce
  1. Generate code with Swagger Hub from yml file (see attached)
  2. Download generated code for typescript-angular (see attached)
  3. Create new angular project with ng-cli and copy generated code
  4. Compile with ng build - see errors in console
Suggest a fix/enhancement

Fix the generated code so that it compiles.

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

Unpack openapi.zip and typescript-angular-client-generated.zip, then run ng build on the generated client to reproduce the missing-brace error in diary.service.ts at line 229. Compare the generated source with the OpenAPI input and locate the typescript-angular generation template responsible; done when the attached API definition produces code that compiles without manual edits.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
build-system, 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.