fix(typescript-angular): make sure basePath is defined before assignment (#18457)

* fix(typescript-angular): make sure basePath is defined before assignment

* Update modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache

Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>

* Update modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache

Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>

* chore(typescript-angular): update examples

---------

Co-authored-by: Esteban Gehring <esteban.gehring@gmail.com>
This commit is contained in:
jase 2024-04-29 18:07:45 +02:00 committed by GitHub
parent 5f136557ba
commit 8faa77cd1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
38 changed files with 114 additions and 76 deletions

View File

@ -71,8 +71,9 @@ export class {{classname}} {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class PetService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class PetService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class DefaultService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -44,8 +44,9 @@ export class PetService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class StoreService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class UserService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -44,8 +44,9 @@ export class PetService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class StoreService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class UserService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -44,8 +44,9 @@ export class PetService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class StoreService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class UserService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class DefaultService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -44,8 +44,9 @@ export class PetService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class StoreService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class UserService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -44,8 +44,9 @@ export class PetService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class StoreService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class UserService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -44,8 +44,9 @@ export class PetService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class StoreService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class UserService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -44,8 +44,9 @@ export class PetService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class StoreService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class UserService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -44,8 +44,9 @@ export class PetService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class StoreService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class UserService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -44,8 +44,9 @@ export class PetService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class StoreService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class UserService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -44,8 +44,9 @@ export class PetService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class StoreService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class UserService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -44,8 +44,9 @@ export class PetService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class StoreService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {

View File

@ -42,8 +42,9 @@ export class UserService {
this.configuration = configuration; this.configuration = configuration;
} }
if (typeof this.configuration.basePath !== 'string') { if (typeof this.configuration.basePath !== 'string') {
if (Array.isArray(basePath) && basePath.length > 0) { const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
basePath = basePath[0]; if (firstBasePath != undefined) {
basePath = firstBasePath;
} }
if (typeof basePath !== 'string') { if (typeof basePath !== 'string') {