-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
Abstract typescript generator makes sure the generated model names do not conflict with reserved words / builtin objects.
However, with typescript-angular, this check is performed before the model suffix is appended, thus returning a false positive and ending up with a bogus model name.
openapi-generator version
Latest master and latest stable
OpenAPI declaration file content or url
Example schema: https://gist.github.com/amakhrov/1185d166a5c9ea6fc72de709a7be3795
The important part is that the model is called Error which is a name of a built-in object in TS:
definitions:
Error:
... model definition
Command line used for generation
java -jar ./openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
-i https://gist.githubusercontent.com/amakhrov/1185d166a5c9ea6fc72de709a7be3795/raw/e619d67f1d4e126981cd2ce900d46adee891cd32/example-schema.yaml \
-g typescript-angular \
--config ./config.json \
-o ./generated
// config.json
{"modelSuffix":"Model"}
```
##### Steps to reproduce
- Run the command above.
- Check generated `models/error.ts` file
Expected model name: `ErrorModel`
Actually generated model name: `ModelErrorModel`
##### Suggest a fix
TODO: add link to PR
Reactions are currently unavailable