swagger-api / swagger-api/swagger-codegen
[Typescript-Angular] Client code does not compile (missing braces)
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:
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
- Generate code with Swagger Hub from yml file (see attached)
- Download generated code for typescript-angular (see attached)
- Create new angular project with ng-cli and copy generated code
- Compile with ng build - see errors in console
Suggest a fix/enhancement
Fix the generated code so that it compiles.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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