Skip to content

Commit e844668

Browse files
committed
feat(typescript-angular): add angular 21 support
1 parent ae8352d commit e844668

File tree

89 files changed

+25032
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+25032
-4
lines changed

.github/workflows/samples-typescript-client.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
paths:
66
- samples/client/others/typescript-angular/**
77
- samples/client/others/typescript-angular-v20/**
8+
- samples/client/others/typescript-angular-v21/**
89
# comment out angular released before Nov 2023
910
#- samples/client/petstore/typescript-angular-v12-provided-in-root/**
1011
#- samples/client/petstore/typescript-angular-v13-provided-in-root/**
@@ -15,6 +16,7 @@ on:
1516
- samples/client/petstore/typescript-angular-v18-provided-in-root/**
1617
- samples/client/petstore/typescript-angular-v19-provided-in-root/**
1718
- samples/client/petstore/typescript-angular-v20-provided-in-root/**
19+
- samples/client/petstore/typescript-angular-v21-provided-in-root/**
1820
- samples/openapi3/client/petstore/typescript/builds/default/**
1921
# comment out due to build failure
2022
#- samples/openapi3/client/petstore/typescript/tests/default/**
@@ -45,6 +47,7 @@ on:
4547
paths:
4648
- samples/client/others/typescript-angular/**
4749
- samples/client/others/typescript-angular-v20/**
50+
- samples/client/others/typescript-angular-v21/**
4851
#- samples/client/petstore/typescript-angular-v12-provided-in-root/**
4952
#- samples/client/petstore/typescript-angular-v13-provided-in-root/**
5053
#- samples/client/petstore/typescript-angular-v14-provided-in-root/**
@@ -54,6 +57,7 @@ on:
5457
- samples/client/petstore/typescript-angular-v18-provided-in-root/**
5558
- samples/client/petstore/typescript-angular-v19-provided-in-root/**
5659
- samples/client/petstore/typescript-angular-v20-provided-in-root/**
60+
- samples/client/petstore/typescript-angular-v21-provided-in-root/**
5761
- samples/openapi3/client/petstore/typescript/builds/default/**
5862
#- samples/openapi3/client/petstore/typescript/tests/default/**
5963
- samples/openapi3/client/petstore/typescript/builds/jquery/**
@@ -95,6 +99,7 @@ jobs:
9599
sample:
96100
- samples/client/others/typescript-angular/
97101
- samples/client/others/typescript-angular-v20/
102+
- samples/client/others/typescript-angular-v21/
98103
#- samples/client/petstore/typescript-angular-v12-provided-in-root/
99104
#- samples/client/petstore/typescript-angular-v13-provided-in-root/
100105
#- samples/client/petstore/typescript-angular-v14-provided-in-root/
@@ -104,6 +109,7 @@ jobs:
104109
- samples/client/petstore/typescript-angular-v18-provided-in-root/
105110
- samples/client/petstore/typescript-angular-v19-provided-in-root/
106111
- samples/client/petstore/typescript-angular-v20-provided-in-root/
112+
- samples/client/petstore/typescript-angular-v21-provided-in-root/
107113
- samples/openapi3/client/petstore/typescript/builds/default/
108114
#- samples/openapi3/client/petstore/typescript/tests/default/
109115
- samples/openapi3/client/petstore/typescript/builds/jquery/
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
generatorName: typescript-angular
2+
outputDir: samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
5+
additionalProperties:
6+
ngVersion: 21.0.0
7+
supportsES6: true
8+
enumNameMappings:
9+
delivered: SHIPPED
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
generatorName: typescript-angular
2+
outputDir: samples/client/petstore/typescript-angular-v21/builds/default
3+
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
5+
additionalProperties:
6+
ngVersion: 21.0.0
7+
npmName: sample-angular-21-0-0
8+
supportsES6: true

docs/generators/typescript-angular.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ title: Documentation for the typescript-angular Generator
1111
| generator type | CLIENT | |
1212
| generator language | Typescript | |
1313
| generator default templating engine | mustache | |
14-
| helpTxt | Generates a TypeScript Angular (9.x - 20.x) client library. | |
14+
| helpTxt | Generates a TypeScript Angular (9.x - 21.x) client library. | |
1515

1616
## CONFIG OPTIONS
1717
These options may be applied as additional-properties (cli) or configOptions (plugins). Refer to [configuration docs](https://openapi-generator.tech/docs/configuration) for more details.
@@ -34,7 +34,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
3434
|modelPropertyNaming|Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name. Only change it if you provide your own run-time code for (de-)serialization of models| |original|
3535
|modelSuffix|The suffix of the generated model.| |null|
3636
|ngPackagrVersion|The version of ng-packagr compatible with Angular (see ngVersion option).| |null|
37-
|ngVersion|The version of Angular. (At least 9.0.0)| |20.0.0|
37+
|ngVersion|The version of Angular. (At least 9.0.0)| |21.0.0|
3838
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
3939
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
4040
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static enum PROVIDED_IN_LEVEL {none, root, any, platform}
8484
public static final String NGPACKAGR_VERSION = "ngPackagrVersion";
8585
public static final String ZONEJS_VERSION = "zonejsVersion";
8686

87-
protected String ngVersion = "20.0.0";
87+
protected String ngVersion = "21.0.0";
8888
@Getter @Setter
8989
protected String npmRepository = null;
9090
@Setter(AccessLevel.PRIVATE) private boolean useSingleRequestParameter = false;
@@ -170,7 +170,7 @@ public String getName() {
170170

171171
@Override
172172
public String getHelp() {
173-
return "Generates a TypeScript Angular (9.x - 20.x) client library.";
173+
return "Generates a TypeScript Angular (9.x - 21.x) client library.";
174174
}
175175

176176
@Override

modules/openapi-generator/src/main/resources/typescript-angular/angularDependenciesByVersion.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# For future versions...
22
# Get typescript and rxjs version here: https://angular.dev/reference/versions
33
# Get zone.js version here: https://github.com/angular/angular/blob/main/packages/core/package.json
4+
21.0.0:
5+
tsVersion: '>=5.9.0 <6.0.0'
6+
rxjsVersion: 7.4.0
7+
ngPackagrVersion: 21.0.0
8+
zonejsVersion: 0.15.0
49
20.0.0:
510
tsVersion: '>=5.8.0 <5.9.0'
611
rxjsVersion: 7.4.0
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "tests",
5+
"projects": {
6+
"test-default": {
7+
"root": "tests/default",
8+
"sourceRoot": "tests/default/src",
9+
"projectType": "application",
10+
"prefix": "app",
11+
"schematics": {},
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:application",
15+
"options": {
16+
"aot": true,
17+
"outputPath": {
18+
"base": "tests/default/dist"
19+
},
20+
"index": "tests/default/src/index.html",
21+
"polyfills": [
22+
"tests/default/src/polyfills.ts"
23+
],
24+
"tsConfig": "tests/default/src/tsconfig.app.json",
25+
"assets": [
26+
"tests/default/src/favicon.ico",
27+
"tests/default/src/assets"
28+
],
29+
"styles": [
30+
"tests/default/src/styles.css"
31+
],
32+
"scripts": [],
33+
"browser": "tests/default/src/main.ts"
34+
},
35+
"configurations": {
36+
"production": {
37+
"budgets": [
38+
{
39+
"type": "anyComponentStyle",
40+
"maximumWarning": "6kb"
41+
}
42+
],
43+
"fileReplacements": [
44+
{
45+
"replace": "tests/default/src/environments/environment.ts",
46+
"with": "tests/default/src/environments/environment.prod.ts"
47+
}
48+
],
49+
"optimization": true,
50+
"outputHashing": "all",
51+
"sourceMap": false,
52+
"namedChunks": false,
53+
"aot": true,
54+
"extractLicenses": true
55+
},
56+
"development": {}
57+
},
58+
"defaultConfiguration": "production"
59+
},
60+
"serve": {
61+
"builder": "@angular-devkit/build-angular:dev-server",
62+
"options": {
63+
},
64+
"configurations": {
65+
"production": {
66+
"browserTarget": "test-default:build:production"
67+
},
68+
"development": {
69+
"browserTarget": "test-default:build:development"
70+
}
71+
},
72+
"defaultConfiguration": "development"
73+
},
74+
"extract-i18n": {
75+
"builder": "@angular-devkit/build-angular:extract-i18n",
76+
"options": {
77+
"browserTarget": "test-default:build"
78+
}
79+
},
80+
"test": {
81+
"builder": "@angular-devkit/build-angular:karma",
82+
"options": {
83+
"main": "tests/default/src/test.ts",
84+
"polyfills": "tests/default/src/polyfills.ts",
85+
"tsConfig": "tests/default/src/tsconfig.spec.json",
86+
"karmaConfig": "tests/default/src/karma.conf.js",
87+
"styles": [
88+
"tests/default/src/styles.css"
89+
],
90+
"scripts": [],
91+
"assets": [
92+
"tests/default/src/favicon.ico",
93+
"tests/default/src/assets"
94+
]
95+
}
96+
},
97+
"lint": {
98+
"builder": "@angular-devkit/build-angular:tslint",
99+
"options": {
100+
"tsConfig": [
101+
"tests/default/src/tsconfig.app.json",
102+
"tests/default/src/tsconfig.spec.json"
103+
],
104+
"exclude": [
105+
"**/node_modules/**"
106+
]
107+
}
108+
}
109+
}
110+
}
111+
},
112+
"cli": {
113+
"analytics": false
114+
}
115+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
wwwroot/*.js
2+
node_modules
3+
typings
4+
dist
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.gitignore
2+
README.md
3+
api.base.service.ts
4+
api.module.ts
5+
api/api.ts
6+
api/pet.service.ts
7+
api/store.service.ts
8+
api/user.service.ts
9+
configuration.ts
10+
encoder.ts
11+
git_push.sh
12+
index.ts
13+
model/apiResponse.ts
14+
model/category.ts
15+
model/models.ts
16+
model/order.ts
17+
model/pet.ts
18+
model/tag.ts
19+
model/user.ts
20+
param.ts
21+
provide-api.ts
22+
query.params.ts
23+
variables.ts

0 commit comments

Comments
 (0)