-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
feat(typescript-angular): add support for Angular V19 #20205
feat(typescript-angular): add support for Angular V19 #20205
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intent LGTM.
Two comments:
- it doesn't currently generate a package.json anywhere, so we don't actually install the required angular version anywhere and check that the types work. Can you see a way to add that, so a generated sample would be picked up by https://github.com/OpenAPITools/openapi-generator/blob/master/.github/workflows/samples-typescript-typecheck.yaml and checked against an actual typescript version it is produced for and its typings.
- It might be worth cleaning the if/else up in the Java code and use a properties file or similar to manage the
atLeast
,tsVersion
,rxjsVersion
,ngPackagrVersion
andzoneJsVersion
combinations?
another option could be to include something in the |
Hi, I don't really understand the first point, could you develop the workflow of generation check? |
So let's say some types change from Angluar 18 -> 19 that makes some Typescript code generated by the openapi generator invalid, then the typecheck CI step will pick that up and fail. It currently only runs on generated samples under openapi-generator/bin/ts-typecheck-all.sh Lines 34 to 37 in 326f100
For the current typescript-angular samples like the one you just added for v19, neither is true, so they are not typechecked, meaning that CI passes even though there might be type errors. That is, unless there is something inside |
Ok thanks, I will try to do this. For the second point, will it not be more flexible to add cli options for defining |
Amazing!
I actually think that makes a lot of sense, but I do not have insight on why it is the way it is. |
I agree, but it could be cool to support both solution? Regular "clean" update with new release of openapi-generator or possibility to override for power user ...or impatient user ;) I just pushed a new commit with the refactoring of Angular dependencies declaration + definition of new cli options. What do you think? |
e2746e2
to
6ffefb4
Compare
…ctor deps definition add tsVersion, rxjsVersion, ngPackagrVersion and zonejsVersion options to override default config if new version of Angular is available but not yet implemented in openapi-generator refactor Angular dependencies definition in separate readable yaml config file fix OpenAPITools#20204
6ffefb4
to
22f8154
Compare
d2dc80f
to
82f8d02
Compare
Hey @joscha I just pushed one more commit to resolve your first point:
Could you review it and tell me if it is good for you? Thanks :) |
1b56a43
to
2156bfc
Compare
2156bfc
to
933c2dc
Compare
I think it's great, as it alleviates the need to make a pull request to this repo each time there's a new version, but as said before, it also removes the set of "blessed" versions. I saw you put them into a yaml file to keep them around, which is great, however, so maybe that's good enough? - @macjohnny WDYT?
I don't think that currently works. The code here: openapi-generator/bin/ts-typecheck-all.sh Line 29 in 26609e9
samples/client/petstore/typescript-angular-v19-provided-in-root/ ).However, whilst the package.json you added is in here: samples/client/petstore/typescript-angular-v19-provided-in-root/package.json it doesn't seem to be one that is where there is the auto-generated code - the autogenerated code seems to be in samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/ ? So this part: openapi-generator/bin/ts-typecheck-all.sh Lines 30 to 32 in 26609e9
Now I am not sure why the package.json is two directories up, maybe because of the integration etst being executed from there? But it does mean that the typecheck will not run for this sample. A few ideas:
Personal order of preference would be: 3,2,1,4 - interested in your thoughts? |
i think we should keep the set of blessed versions. for the impatient, there is always the very easy way to write a postprocessing script. |
@joscha Thanks for your comments! But I'm a bit lost with the package.json things. What is the purpose of that check? What I did is generating an Angular app and importing open api sample to check if everything is fine. Which it is. Would it be more secure to check if the app compile and launch unit test for example? @macjohnny In that PR there is the two alternatives: the "blessed versions" (refactored with clean config file) and the "fine tuned version" with cli options. Would you like that I remove that new extra options? Or the two possibilities can be complementary ? |
It makes sure the generated Typescript compiles with the dependency versions specified and there are no type errors.
It's okay, let's go with 4) for now. Nothing to do, your sample is not worse or different than all the other angular samples.
Yes, the type check would necessarily be implicity part of that if it can be executed. I am happy with the current state. If we improve it, we should really improve all thos samples, not only one anyway. |
@thibaudsowa thanks for your contribution! |
Changes
Add support for Angular 19
I have replicated PR #18916 for angular 19
Fix #20204
Technical committee
@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) @joscha (2024/10)
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming7.x.0
minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)