-
-
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-*][possibly other languages] Missing fields when using allOf composition #16150
Comments
in the latest master, the option name is
|
I did a test with java client generator:
but don't see missing properties. Maybe I missed missing. What properties are missing? |
Hi, I think it is only broken for functional languages that don't have inheritance, e.g. typescript/js. When using the typescript-axios sample (and using the typescript axios generator) it used to create the following:
|
I assume you've tried to use the rule/option |
I just did that right now, before that i just copied your answer, sorry. |
ok. please use the rule/option for fallback for the time being. Do you know if all TS generators need this fallback or just |
cc @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04) |
As far as i can see it atleast also affects the |
This problem still persists with the latest version 7.2.0 in typescript-axios generator. |
-- Add the following changes: - support for earlier version of bash (the default bash version is 3.2.57 on MacOS) - add a workaround for this issue: OpenAPITools/openapi-generator#16150 - update version of openapi-generator to 7.4.0
-- Add the following changes: - support for earlier version of bash (the default bash version is 3.2.57 on MacOS) - add a workaround for this issue: OpenAPITools/openapi-generator#16150 - update version of openapi-generator to 7.4.0
This problem is still present with the latest version 7.4.0 |
Same boat. We still use 6.6.0 because of this issue. |
This issue is still in Version 7.5.0 |
you are welcome to send a PR to fix this |
Also hit by this issue, but it can be solved by setting |
Good call |
Maybe I am missing something, but I have tried setting this option, yet it does not solve the issue for me. After running /**
* @type Test200Response
* @export
*/
export type Test200Response = ApiResult; If I set I'm running generator version 7.6.0 (latest as of writing). EDIT: It is working, I made a mistake with the setting I used. My bad, sorry for the confusion! |
Description
When working on an enhancement of the typescript-axios generation I've noticed fields missing in the generated classes.
This PR changed the way inline schemas are handled. This was done among other things in order to remove dangling/useless *allOf classes that existed in e.g. java. During this commit changes to the typescript examples have been comittet that removed the *allOf classes withouth regard of them now missing fields. This can for e.g. be seen when comparing the generated flat-stock-pick-order-dto.ts with the corresponding spec file.
I've tried using
--inline-schema-name-defaults REFACTOR_ALLOF_INLINE_SCHEMAS=true
with the locally build jar of the current master but couldn't get that to work. I'll include my command line arguments used, I probably did something wrong.This also seems to be a problem for the atleast the typescript-rxjs/allOf-composition example aswell, where SuperBoy, SuperBaby & Superman are missing properties now.
openapi-generator version
Current master
OpenAPI declaration file content or url
Spec File
Command line used for generation
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g typescript-axios -i modules/openapi-generator/src/test/resources/3_0/typescript-axios/with-separate-models-and-api-inheritance.yaml -o samples/client/others/typescript-axios/with-separate-models-and-api-inheritance --additional-properties=withSeparateModelsAndApi=true --additional-properties=apiPackage=api --additional-properties=modelPackage=model --additional-properties=legacyDiscriminatorBehavior=false --inline-schema-name-defaults REFACTOR_ALLOF_INLINE_SCHEMAS=true
Steps to reproduce
./bin/generate-samples.sh ./bin/configs/typescript-axios-with-separate-models-and-api-inheritance.yaml
Related issues/PRs
Related Pull Requests: #15682
Suggest a fix/enhancement
If
--inline-schema-name-defaults REFACTOR_ALLOF_INLINE_SCHEMAS=true
works (which again maybe i was just too dumb to get to work) and fixes this issue it should probably be enabled by default for the typescript generators the same way it is for the csharp client generators as mentioned in the PR.Additionally, tests should be added that check if properties are missing in generated types. As
*typescript-axios/with-separate-models-and-api-inheritance
was added by our team we would be willing to add those in a PR once the issue has been resolved.The text was updated successfully, but these errors were encountered: