Skip to content

feat: add support for Angular 22 - #24420

Merged
wing328 merged 2 commits into
OpenAPITools:masterfrom
faltfe:feature/support-angular-22
Jul 25, 2026
Merged

wing328 merged 2 commits into
OpenAPITools:masterfrom
faltfe:feature/support-angular-22

Conversation

@faltfe

@faltfe faltfe commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Fixes: #23973
based on #22636

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    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.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Adds Angular 22 support to the typescript-angular generator and makes 22.0.0 the default. Updates docs, dependency mappings, samples, tests, and CI to generate and validate Angular 22 clients.

  • New Features

    • Default ngVersion set to 22.0.0; help/docs now show 9.x–22.x.
    • Added Angular 22 mapping: TypeScript >=6.0.0 <6.1.0, rxjs 7.4.0, ng-packagr 22.0.0, zone.js 0.15.0.
    • New configs: bin/configs/typescript-angular-v22.yaml and ...-v22-provided-in-root.yaml, with generated samples and a provided-in-root test app; CI updated to include typescript-angular-v22-provided-in-root.
  • Migration

    • To stay on Angular ≤21, set additionalProperties.ngVersion to your target (e.g., 21.0.0) or use the v21 configs.

Written for commit 002efbf. Summary will update on new commits.

Review in cubic

@faltfe

faltfe commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

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)

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 @@
{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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': ' ',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Suggested change
// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
// `ng build --configuration production` replaces `environment.ts` with `environment.prod.ts`.

Comment thread samples/client/petstore/typescript-angular-v22-provided-in-root/package.json Outdated
@wing328 wing328 added this to the 7.25.0 milestone Jul 25, 2026
@wing328
wing328 merged commit 600f2f5 into OpenAPITools:master Jul 25, 2026
31 checks passed
@wing328

wing328 commented Jul 25, 2026

Copy link
Copy Markdown
Member

thanks for the PR which has been merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REQ] Support for Angular V22

2 participants