Skip to content
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

Add support for Angular 16 #15925

Merged
merged 5 commits into from
Jul 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se

| | Languages/Frameworks |
| -------------------------------- |-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient 4.x, Apache HttpClient 5.x, Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client, Helidon), **Jetbrains HTTP Client**, **Julia**, **k6**, **Kotlin**, **Lua**, **N4JS**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (2.x - 15.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs), **XoJo** |
| **API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C**, **C#** (.net 2.0, 3.5 or later, .NET Standard 1.3 - 2.1, .NET Core 3.1, .NET 5.0. Libraries: RestSharp, GenericHost, HttpClient), **C++** (Arduino, cpp-restsdk, Qt5, Tizen, Unreal Engine 4), **Clojure**, **Crystal**, **Dart**, **Elixir**, **Elm**, **Eiffel**, **Erlang**, **Go**, **Groovy**, **Haskell** (http-client, Servant), **Java** (Apache HttpClient 4.x, Apache HttpClient 5.x, Jersey1.x, Jersey2.x, OkHttp, Retrofit1.x, Retrofit2.x, Feign, RestTemplate, RESTEasy, Vertx, Google API Client Library for Java, Rest-assured, Spring 5 Web Client, MicroProfile Rest Client, Helidon), **Jetbrains HTTP Client**, **Julia**, **k6**, **Kotlin**, **Lua**, **N4JS**, **Nim**, **Node.js/JavaScript** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types, Apollo GraphQL DataStore), **Objective-C**, **OCaml**, **Perl**, **PHP**, **PowerShell**, **Python**, **R**, **Ruby**, **Rust** (hyper, reqwest, rust-server), **Scala** (akka, http4s, scalaz, sttp, swagger-async-httpclient), **Swift** (2.x, 3.x, 4.x, 5.x), **Typescript** (AngularJS, Angular (9.x - 16.x), Aurelia, Axios, Fetch, Inversify, jQuery, Nestjs, Node, redux-query, Rxjs), **XoJo** |
| **Server stubs** | **Ada**, **C#** (ASP.NET Core, Azure Functions), **C++** (Pistache, Restbed, Qt5 QHTTPEngine), **Erlang**, **F#** (Giraffe), **Go** (net/http, Gin, Echo), **Haskell** (Servant, Yesod), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, Jersey, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples), [Vert.x](https://vertx.io/), [Apache Camel](https://camel.apache.org/), [Helidon](https://helidon.io/)), **Julia**, **Kotlin** (Spring Boot, [Ktor](https://github.com/ktorio/ktor), [Vert.x](https://vertx.io/)), **PHP** (Laravel, Lumen, [Mezzio (fka Zend Expressive)](https://github.com/mezzio/mezzio), Slim, Silex, [Symfony](https://symfony.com/)), **Python** (FastAPI, Flask), **NodeJS**, **Ruby** (Sinatra, Rails5), **Rust** ([rust-server](https://openapi-generator.tech/docs/generators/rust-server/)), **Scala** (Akka, [Finch](https://github.com/finagle/finch), [Lagom](https://github.com/lagom/lagom), [Play](https://www.playframework.com/), Scalatra) |
| **API documentation generators** | **HTML**, **Confluence Wiki**, **Asciidoc**, **Markdown**, **PlantUML** |
| **Configuration files** | [**Apache2**](https://httpd.apache.org/) |
Expand Down
7 changes: 7 additions & 0 deletions bin/configs/typescript-angular-v16-provided-in-root.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
generatorName: typescript-angular
outputDir: samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/typescript-angular
additionalProperties:
ngVersion: 16.1.2
supportsES6: true
4 changes: 2 additions & 2 deletions docs/generators/typescript-angular.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ title: Documentation for the typescript-angular Generator
| generator type | CLIENT | |
| generator language | Typescript | |
| generator default templating engine | mustache | |
| helpTxt | Generates a TypeScript Angular (9.x - 15.x) client library. | |
| helpTxt | Generates a TypeScript Angular (9.x - 16.x) client library. | |

## CONFIG OPTIONS
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.
Expand All @@ -31,7 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|modelFileSuffix|The suffix of the file of the generated model (model<suffix>.ts).| |null|
|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|
|modelSuffix|The suffix of the generated model.| |null|
|ngVersion|The version of Angular. (At least 9.0.0)| |15.0.3|
|ngVersion|The version of Angular. (At least 9.0.0)| |16.1.2|
|npmName|The name under which you want to publish generated npm package. Required to generate a full package| |null|
|npmRepository|Use this property to set an url your private npmRepo in the package.json| |null|
|npmVersion|The version of your npm package. If not provided, using the version from the OpenAPI specification file.| |1.0.0|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static enum PROVIDED_IN_LEVEL {none, root, any, platform}
public static final String STRING_ENUMS_DESC = "Generate string enums instead of objects for enum values.";
public static final String QUERY_PARAM_OBJECT_FORMAT = "queryParamObjectFormat";

protected String ngVersion = "15.0.3";
protected String ngVersion = "16.1.2";
protected String npmRepository = null;
private boolean useSingleRequestParameter = false;
protected String serviceSuffix = "Service";
Expand Down Expand Up @@ -152,7 +152,7 @@ public String getName() {

@Override
public String getHelp() {
return "Generates a TypeScript Angular (9.x - 15.x) client library.";
return "Generates a TypeScript Angular (9.x - 16.x) client library.";
}

@Override
Expand Down Expand Up @@ -282,7 +282,12 @@ private void addNpmPackageGeneration(SemVer ngVersion) {
}

// Set the typescript version compatible to the Angular version
if (ngVersion.atLeast("15.0.0")) {
// based on https://angular.io/guide/versions#actively-supported-versions
if (ngVersion.atLeast("16.1.0")) {
additionalProperties.put("tsVersion", ">=4.9.3 <5.2.0");
} else if (ngVersion.atLeast("16.0.0")) {
additionalProperties.put("tsVersion", ">=4.9.3 <5.1.0");
} else if (ngVersion.atLeast("15.0.0")) {
additionalProperties.put("tsVersion", ">=4.8.2 <4.10.0");
} else if (ngVersion.atLeast("14.0.0")) {
additionalProperties.put("tsVersion", ">=4.6.0 <=4.8.0");
Expand All @@ -301,7 +306,9 @@ private void addNpmPackageGeneration(SemVer ngVersion) {
}

// Set the rxJS version compatible to the Angular version
if (ngVersion.atLeast("15.0.0")) {
if (ngVersion.atLeast("16.0.0")) {
additionalProperties.put("rxjsVersion", "7.4.0");
} else if (ngVersion.atLeast("15.0.0")) {
additionalProperties.put("rxjsVersion", "7.5.5");
} else if (ngVersion.atLeast("14.0.0")) {
additionalProperties.put("rxjsVersion", "7.5.5");
Expand All @@ -316,7 +323,11 @@ private void addNpmPackageGeneration(SemVer ngVersion) {
supportingFiles.add(new SupportingFile("ng-package.mustache", getIndexDirectory(), "ng-package.json"));

// Specific ng-packagr configuration
if (ngVersion.atLeast("15.0.0")) {
if (ngVersion.atLeast("16.0.0")) {
additionalProperties.put("ngPackagrVersion", "16.0.0");
// tsTickle is not required and there is no available version compatible with
// versions of TypeScript compatible with Angular 16.
} else if (ngVersion.atLeast("15.0.0")) {
additionalProperties.put("ngPackagrVersion", "15.0.2");
// tsTickle is not required and there is no available version compatible with
// versions of TypeScript compatible with Angular 15.
Expand All @@ -341,7 +352,9 @@ private void addNpmPackageGeneration(SemVer ngVersion) {
}

// set zone.js version
if (ngVersion.atLeast("15.0.0")) {
if (ngVersion.atLeast("16.0.0")) {
additionalProperties.put("zonejsVersion", "0.13.0");
} else if (ngVersion.atLeast("15.0.0")) {
additionalProperties.put("zonejsVersion", "0.11.5");
} else if (ngVersion.atLeast("14.0.0")) {
additionalProperties.put("zonejsVersion", "0.11.5");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core
import { Configuration } from './configuration';
import { HttpClient } from '@angular/common/http';

import { UserService } from './api/user.service';

@NgModule({
imports: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
"build": "ng-packagr -p ng-package.json"
},
"peerDependencies": {
"@angular/core": "^15.0.3",
"rxjs": "^7.5.5"
"@angular/core": "^16.1.2",
"rxjs": "^7.4.0"
},
"devDependencies": {
"@angular/common": "^15.0.3",
"@angular/compiler": "^15.0.3",
"@angular/compiler-cli": "^15.0.3",
"@angular/core": "^15.0.3",
"@angular/platform-browser": "^15.0.3",
"ng-packagr": "^15.0.2",
"@angular/common": "^16.1.2",
"@angular/compiler": "^16.1.2",
"@angular/compiler-cli": "^16.1.2",
"@angular/core": "^16.1.2",
"@angular/platform-browser": "^16.1.2",
"ng-packagr": "^16.0.0",
"reflect-metadata": "^0.1.3",
"rxjs": "^7.5.5",
"typescript": ">=4.8.2 <4.10.0",
"zone.js": "^0.11.5"
"rxjs": "^7.4.0",
"typescript": ">=4.9.3 <5.2.0",
"zone.js": "^0.13.0"
}}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core
import { Configuration } from './configuration';
import { HttpClient } from '@angular/common/http';

import { ProjectService } from './api/project.service';

@NgModule({
imports: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
"build": "ng-packagr -p ng-package.json"
},
"peerDependencies": {
"@angular/core": "^15.0.3",
"rxjs": "^7.5.5"
"@angular/core": "^16.1.2",
"rxjs": "^7.4.0"
},
"devDependencies": {
"@angular/common": "^15.0.3",
"@angular/compiler": "^15.0.3",
"@angular/compiler-cli": "^15.0.3",
"@angular/core": "^15.0.3",
"@angular/platform-browser": "^15.0.3",
"ng-packagr": "^15.0.2",
"@angular/common": "^16.1.2",
"@angular/compiler": "^16.1.2",
"@angular/compiler-cli": "^16.1.2",
"@angular/core": "^16.1.2",
"@angular/platform-browser": "^16.1.2",
"ng-packagr": "^16.0.0",
"reflect-metadata": "^0.1.3",
"rxjs": "^7.5.5",
"typescript": ">=4.8.2 <4.10.0",
"zone.js": "^0.11.5"
"rxjs": "^7.4.0",
"typescript": ">=4.9.3 <5.2.0",
"zone.js": "^0.13.0"
}}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core
import { Configuration } from './configuration';
import { HttpClient } from '@angular/common/http';

import { MatrixParamsService } from './api/matrixParams.service';

@NgModule({
imports: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
"build": "ng-packagr -p ng-package.json"
},
"peerDependencies": {
"@angular/core": "^15.0.3",
"rxjs": "^7.5.5"
"@angular/core": "^16.1.2",
"rxjs": "^7.4.0"
},
"devDependencies": {
"@angular/common": "^15.0.3",
"@angular/compiler": "^15.0.3",
"@angular/compiler-cli": "^15.0.3",
"@angular/core": "^15.0.3",
"@angular/platform-browser": "^15.0.3",
"ng-packagr": "^15.0.2",
"@angular/common": "^16.1.2",
"@angular/compiler": "^16.1.2",
"@angular/compiler-cli": "^16.1.2",
"@angular/core": "^16.1.2",
"@angular/platform-browser": "^16.1.2",
"ng-packagr": "^16.0.0",
"reflect-metadata": "^0.1.3",
"rxjs": "^7.5.5",
"typescript": ">=4.8.2 <4.10.0",
"zone.js": "^0.11.5"
"rxjs": "^7.4.0",
"typescript": ">=4.9.3 <5.2.0",
"zone.js": "^0.13.0"
}}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core
import { Configuration } from './configuration';
import { HttpClient } from '@angular/common/http';

import { PetService } from './api/pet.service';
import { StoreService } from './api/store.service';
import { UserService } from './api/user.service';

@NgModule({
imports: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
"build": "ng-packagr -p ng-package.json"
},
"peerDependencies": {
"@angular/core": "^15.0.3",
"rxjs": "^7.5.5"
"@angular/core": "^16.1.2",
"rxjs": "^7.4.0"
},
"devDependencies": {
"@angular/common": "^15.0.3",
"@angular/compiler": "^15.0.3",
"@angular/compiler-cli": "^15.0.3",
"@angular/core": "^15.0.3",
"@angular/platform-browser": "^15.0.3",
"ng-packagr": "^15.0.2",
"@angular/common": "^16.1.2",
"@angular/compiler": "^16.1.2",
"@angular/compiler-cli": "^16.1.2",
"@angular/core": "^16.1.2",
"@angular/platform-browser": "^16.1.2",
"ng-packagr": "^16.0.0",
"reflect-metadata": "^0.1.3",
"rxjs": "^7.5.5",
"typescript": ">=4.8.2 <4.10.0",
"zone.js": "^0.11.5"
"rxjs": "^7.4.0",
"typescript": ">=4.9.3 <5.2.0",
"zone.js": "^0.13.0"
}}
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,7 @@
<module>samples/client/petstore/typescript-angular-v13-provided-in-root</module>
<module>samples/client/petstore/typescript-angular-v14-provided-in-root</module>
<module>samples/client/petstore/typescript-angular-v15-provided-in-root</module>
<module>samples/client/petstore/typescript-angular-v16-provided-in-root</module>
<module>samples/openapi3/client/petstore/typescript/builds/default</module>
<module>samples/openapi3/client/petstore/typescript/tests/default</module>
<module>samples/openapi3/client/petstore/typescript/builds/jquery</module>
Expand Down
Loading
Loading