feat: add support for Angular 22 - #24420
Conversation
|
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) @joscha (2024/10) @KannaKim (2026/07) |
There was a problem hiding this comment.
17 issues found across 88 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="samples/client/petstore/typescript-angular-v22-provided-in-root/builds/default/git_push.sh">
<violation number="1" location="samples/client/petstore/typescript-angular-v22-provided-in-root/builds/default/git_push.sh:48">
P1: Publishing with `GIT_TOKEN` leaves the credential persisted in `.git/config` as part of `origin`, exposing it through `git remote -v` and checkout contents. Keep the remote URL token-free and use a credential helper or askpass-based authentication for the push instead.</violation>
<violation number="2" location="samples/client/petstore/typescript-angular-v22-provided-in-root/builds/default/git_push.sh:57">
P2: A failed push can be reported as success because the pipeline returns `grep`'s status rather than `git push`'s. Run `git push` directly (or capture and propagate its exit status) so automation can detect rejected publishes.</violation>
</file>
<file name="samples/client/petstore/typescript-angular-v22/builds/default/variables.ts">
<violation number="1" location="samples/client/petstore/typescript-angular-v22/builds/default/variables.ts:6">
P2: TSV collection parameters are serialized with three spaces instead of a tab, producing invalid query/form values whenever an operation uses `collectionFormat: tsv`. Using the tab escape sequence preserves the OpenAPI collection format.</violation>
</file>
<file name="samples/client/petstore/typescript-angular-v22/builds/default/git_push.sh">
<violation number="1" location="samples/client/petstore/typescript-angular-v22/builds/default/git_push.sh:48">
P2: Using `GIT_TOKEN` persists the token in `.git/config` as part of `origin`, exposing it after this command completes. Keep the remote URL credential-free and rely on Git's credential helper or a non-persisted authentication mechanism.</violation>
<violation number="2" location="samples/client/petstore/typescript-angular-v22/builds/default/git_push.sh:57">
P2: A rejected push can still make this script exit 0 because `grep` supplies the pipeline status. Preserve `git push`'s status (and update the source template before regenerating) so callers detect failed publishing.</violation>
</file>
<file name="samples/client/petstore/typescript-angular-v22-provided-in-root/builds/default/query.params.ts">
<violation number="1" location="samples/client/petstore/typescript-angular-v22-provided-in-root/builds/default/query.params.ts:92">
P2: `toString()` serializes exploded arrays as `key=a,b`, not documented repeated `key=a&key=b`. Expand array records into individual query-string parts before joining.</violation>
<violation number="2" location="samples/client/petstore/typescript-angular-v22-provided-in-root/builds/default/query.params.ts:158">
P2: Non-exploded object query parameters with a `null` or `undefined` property throw here instead of serializing. Use `String(value)` (or explicitly apply the generator's intended null-value policy) so nullable object fields do not crash request construction.</violation>
</file>
<file name="samples/client/petstore/typescript-angular-v22/builds/default/README.md">
<violation number="1" location="samples/client/petstore/typescript-angular-v22/builds/default/README.md:33">
P2: The local-consumption command points at a tarball that `npm run build` never creates, so following the documented build and install steps fails with a missing-file error. The example could pack the generated `dist` directory before installing the resulting `sample-angular-22-0-0-1.0.0.tgz`.</violation>
<violation number="2" location="samples/client/petstore/typescript-angular-v22/builds/default/README.md:70">
P2: The general usage example does not compile because `provideApi` requires a configuration or base-path argument. Passing an empty configuration (`provideApi({})`) preserves the generated default base path while satisfying the API.</violation>
</file>
<file name="samples/client/petstore/typescript-angular-v22/builds/default/query.params.ts">
<violation number="1" location="samples/client/petstore/typescript-angular-v22/builds/default/query.params.ts:92">
P2: Exploded parameters are serialized incorrectly by `OpenApiHttpParams.toString()`: an array is interpolated as a comma-joined value instead of repeated `key=value` pairs. Iterating array values when building `parts` would make `toString()` match the documented OpenAPI serialization.</violation>
<violation number="2" location="samples/client/petstore/typescript-angular-v22/builds/default/query.params.ts:139">
P2: Object query parameters can include inherited enumerable fields, producing query entries callers did not supply. Iterating own keys matches the other object-serialization path.</violation>
</file>
<file name="samples/client/petstore/typescript-angular-v22-provided-in-root/tests/default/src/environments/environment.ts">
<violation number="1" location="samples/client/petstore/typescript-angular-v22-provided-in-root/tests/default/src/environments/environment.ts:2">
P3: Comment references `ng build ---prod` with three dashes, which was never a valid CLI syntax. The actual Angular CLI flag was `--prod` (two dashes), and it was deprecated in Angular 12 and removed entirely in Angular 14+. In Angular 22, the correct approach is `ng build --configuration production`.</violation>
</file>
<file name="samples/client/petstore/typescript-angular-v22-provided-in-root/tests/default/src/test/fakeBackend.ts">
<violation number="1" location="samples/client/petstore/typescript-angular-v22-provided-in-root/tests/default/src/test/fakeBackend.ts:75">
P2: `updatePet` stores by `String(pet.id)` but `Pet.id` is optional (`id?: number`). When `pet.id` is undefined, `String(undefined)` produces the literal key `"undefined"`, making the pet irretrievable by real numeric IDs and corrupting the store. Validate that `pet.id` is present, or generate an ID when missing.</violation>
</file>
<file name="samples/client/petstore/typescript-angular-v22-provided-in-root/tests/default/src/main.ts">
<violation number="1" location="samples/client/petstore/typescript-angular-v22-provided-in-root/tests/default/src/main.ts:21">
P1: The test application does not register `provideHttpClient(withInterceptors([fakePetstoreBackendInterceptorFn]))`, even though this file imports both the HTTP provider helpers and the fake backend interceptor. As a result, generated API calls in the default tests will lack the HTTP client and will not be intercepted by the fake backend.</violation>
</file>
<file name="samples/client/petstore/typescript-angular-v22-provided-in-root/builds/default/variables.ts">
<violation number="1" location="samples/client/petstore/typescript-angular-v22-provided-in-root/builds/default/variables.ts:6">
P2: TSV collection parameters are serialized with three spaces rather than a tab, producing incorrect header values for array parameters whose `collectionFormat` is `tsv`. Mapping this format to the tab character keeps generated requests compliant with the declared collection format.</violation>
</file>
<file name="samples/client/petstore/typescript-angular-v22-provided-in-root/tslint.json">
<violation number="1" location="samples/client/petstore/typescript-angular-v22-provided-in-root/tslint.json:1">
P1: tslint.json references codelyzer in its rulesDirectory, but package.json does not declare codelyzer as a dependency. This will cause lint runs that load the rulesDirectory to fail with a module-not-found error. Either add codelyzer to devDependencies in package.json and install it, or remove the codelyzer rulesDirectory entry from tslint.json and switch to the already-configured ESLint toolchain (@typescript-eslint) for this project.</violation>
</file>
<file name="samples/client/petstore/typescript-angular-v22/builds/default/package.json">
<violation number="1" location="samples/client/petstore/typescript-angular-v22/builds/default/package.json:20">
P2: The published Angular client uses `@angular/common/http` at runtime but does not declare `@angular/common` as a peer dependency. Listing it only as a dev dependency can leave consumers without the runtime package or without a compatible Angular Common version; it would be safer to declare the matching Angular Common range alongside `@angular/core`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." | ||
| git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git | ||
| else | ||
| git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git |
There was a problem hiding this comment.
P1: Publishing with GIT_TOKEN leaves the credential persisted in .git/config as part of origin, exposing it through git remote -v and checkout contents. Keep the remote URL token-free and use a credential helper or askpass-based authentication for the push instead.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/typescript-angular-v22-provided-in-root/builds/default/git_push.sh, line 48:
<comment>Publishing with `GIT_TOKEN` leaves the credential persisted in `.git/config` as part of `origin`, exposing it through `git remote -v` and checkout contents. Keep the remote URL token-free and use a credential helper or askpass-based authentication for the push instead.</comment>
<file context>
@@ -0,0 +1,57 @@
+ echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
+ git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
+ else
+ git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
+ fi
+
</file context>
| bootstrapApplication(AppComponent, { | ||
| providers: [ | ||
| provideZoneChangeDetection(), | ||
| provideApi(apiConfigurationParams), |
There was a problem hiding this comment.
P1: The test application does not register provideHttpClient(withInterceptors([fakePetstoreBackendInterceptorFn])), even though this file imports both the HTTP provider helpers and the fake backend interceptor. As a result, generated API calls in the default tests will lack the HTTP client and will not be intercepted by the fake backend.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/typescript-angular-v22-provided-in-root/tests/default/src/main.ts, line 21:
<comment>The test application does not register `provideHttpClient(withInterceptors([fakePetstoreBackendInterceptorFn]))`, even though this file imports both the HTTP provider helpers and the fake backend interceptor. As a result, generated API calls in the default tests will lack the HTTP client and will not be intercepted by the fake backend.</comment>
<file context>
@@ -0,0 +1,23 @@
+bootstrapApplication(AppComponent, {
+ providers: [
+ provideZoneChangeDetection(),
+ provideApi(apiConfigurationParams),
+ ]
+}).catch(err => { console.log(err) })
</file context>
| @@ -0,0 +1,129 @@ | |||
| { | |||
There was a problem hiding this comment.
P1: tslint.json references codelyzer in its rulesDirectory, but package.json does not declare codelyzer as a dependency. This will cause lint runs that load the rulesDirectory to fail with a module-not-found error. Either add codelyzer to devDependencies in package.json and install it, or remove the codelyzer rulesDirectory entry from tslint.json and switch to the already-configured ESLint toolchain (@typescript-eslint) for this project.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/typescript-angular-v22-provided-in-root/tslint.json:
<comment>tslint.json references codelyzer in its rulesDirectory, but package.json does not declare codelyzer as a dependency. This will cause lint runs that load the rulesDirectory to fail with a module-not-found error. Either add codelyzer to devDependencies in package.json and install it, or remove the codelyzer rulesDirectory entry from tslint.json and switch to the already-configured ESLint toolchain (@typescript-eslint) for this project.</comment>
<file context>
@@ -0,0 +1,129 @@
+{
+ "rulesDirectory": [
+ "node_modules/codelyzer"
+ ],
+ "rules": {
+ "arrow-return-shorthand": true,
+ "callable-types": true,
+ "class-name": true,
+ "comment-format": [
</file context>
There was a problem hiding this comment.
I don't think that this issue is related to Angular 22 support. It should be resolved in another PR.
|
|
||
| # Pushes (Forces) the changes in the local repository up to the remote repository | ||
| echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" | ||
| git push origin master 2>&1 | grep -v 'To https' |
There was a problem hiding this comment.
P2: A failed push can be reported as success because the pipeline returns grep's status rather than git push's. Run git push directly (or capture and propagate its exit status) so automation can detect rejected publishes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/typescript-angular-v22-provided-in-root/builds/default/git_push.sh, line 57:
<comment>A failed push can be reported as success because the pipeline returns `grep`'s status rather than `git push`'s. Run `git push` directly (or capture and propagate its exit status) so automation can detect rejected publishes.</comment>
<file context>
@@ -0,0 +1,57 @@
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
</file context>
| export const BASE_PATH = new InjectionToken<string>('basePath'); | ||
| export const COLLECTION_FORMATS = { | ||
| 'csv': ',', | ||
| 'tsv': ' ', |
There was a problem hiding this comment.
P2: TSV collection parameters are serialized with three spaces instead of a tab, producing invalid query/form values whenever an operation uses collectionFormat: tsv. Using the tab escape sequence preserves the OpenAPI collection format.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/typescript-angular-v22/builds/default/variables.ts, line 6:
<comment>TSV collection parameters are serialized with three spaces instead of a tab, producing invalid query/form values whenever an operation uses `collectionFormat: tsv`. Using the tab escape sequence preserves the OpenAPI collection format.</comment>
<file context>
@@ -0,0 +1,9 @@
+export const BASE_PATH = new InjectionToken<string>('basePath');
+export const COLLECTION_FORMATS = {
+ 'csv': ',',
+ 'tsv': ' ',
+ 'ssv': ' ',
+ 'pipes': '|'
</file context>
| @@ -0,0 +1,15 @@ | |||
| // This file can be replaced during build by using the `fileReplacements` array. | |||
| // `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`. | |||
There was a problem hiding this comment.
P3: Comment references ng build ---prod with three dashes, which was never a valid CLI syntax. The actual Angular CLI flag was --prod (two dashes), and it was deprecated in Angular 12 and removed entirely in Angular 14+. In Angular 22, the correct approach is ng build --configuration production.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/typescript-angular-v22-provided-in-root/tests/default/src/environments/environment.ts, line 2:
<comment>Comment references `ng build ---prod` with three dashes, which was never a valid CLI syntax. The actual Angular CLI flag was `--prod` (two dashes), and it was deprecated in Angular 12 and removed entirely in Angular 14+. In Angular 22, the correct approach is `ng build --configuration production`.</comment>
<file context>
@@ -0,0 +1,15 @@
+// This file can be replaced during build by using the `fileReplacements` array.
+// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
+// The list of file replacements can be found in `angular.json`.
+
</file context>
| // `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`. | |
| // `ng build --configuration production` replaces `environment.ts` with `environment.prod.ts`. |
|
thanks for the PR which has been merged |
Fixes: #23973
based on #22636
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.
Summary by cubic
Adds Angular 22 support to the
typescript-angulargenerator and makes 22.0.0 the default. Updates docs, dependency mappings, samples, tests, and CI to generate and validate Angular 22 clients.New Features
ngVersionset to 22.0.0; help/docs now show 9.x–22.x.rxjs7.4.0,ng-packagr22.0.0,zone.js0.15.0.bin/configs/typescript-angular-v22.yamland...-v22-provided-in-root.yaml, with generated samples and a provided-in-root test app; CI updated to includetypescript-angular-v22-provided-in-root.Migration
additionalProperties.ngVersionto your target (e.g., 21.0.0) or use the v21 configs.Written for commit 002efbf. Summary will update on new commits.