-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] [typescript-angular] AllOf hierarchy produces api that doesn't compile #8000
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
I have the trouble, me too. |
I'm also observing the same issue in typescript-fetch. As far as I can tell it seems general to all allOf constructions. It correctly generates an intersection type, but there seem to be two issues with the generated code: It might be worth pointing out that the same bug is not present in typescript-axios. Issue 1 described above is not occurring there (it correctly generates |
I'm using typescript-axios and have both issues with the following configuration {
"withSeparateModelsAndApi": true,
"apiPackage": "api",
"modelPackage": "model",
"useSingleRequestParameter": true,
"generateAliasAsModel": true
} ...and an anonymous schema for the response responses:
201:
description: some description
content:
application/json:
schema:
- $ref: '#/components/schemas/ExtendedTransferObjectResponse'
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/ExtendedTransferObject'
+ - type: object |
Any news on this issue? |
`toModelImportMap` only accounts for union types and not intersection types, so I've combined those cases into `splitComposedType`. For `splitComposedType` I combined `replace(" ","").split("\\|")` and `split("( [|&] )|[<>]")` into `replace(" ","").split("[|&<>]")`. I've added the `needToImport` check to `toModelImportMap`. This is the same check that happens in `addImport`.
`toModelImportMap` only accounts for union types and not intersection types, so I've combined those cases into `splitComposedType`. For `splitComposedType` I combined `replace(" ","").split("\\|")` and `split("( [|&] )|[<>]")` into `replace(" ","").split("[|&<>]")`. I've added the `needToImport` check to `toModelImportMap`. This is the same check that happens in `addImport`.
…client The `AbstractTypeScriptClientCodegen` is very similar to the `TypeScriptClientCodegen`. However, they have been kept separate and some fixes brought to the former are not present on the latter. This change makes `TypescriptClientCodegen` extend from `AbstractTypeScriptClientCodegen` to re-use most of the common logic. Similar methods and CLI options were removed from `TypescriptClientCodegen`. The `NPM_REPOSITORY` flag was kept in the typescript client, although it might be sensible to move it to the abstract client and make other typescript-based generators benefit from it. In particular, this change fixes the issue OpenAPITools#8000 for the `typescript` generator which was merged by OpenAPITools#9275.
OpenAPI Spec
Generated with
Results in a
default.service.ts
file with a invalid import statement along with unused classExtendedTransferObject
:The text was updated successfully, but these errors were encountered: