diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index a67cd98cfdc..dee8caaadd3 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -1831,7 +1831,7 @@ public class DefaultCodegen { currentProperty = currentProperty.items; } - return currentProperty.isEnum; + return currentProperty == null ? false : currentProperty.isEnum; } protected Map getInnerEnumAllowableValues(CodegenProperty property) { @@ -1841,7 +1841,7 @@ public class DefaultCodegen { currentProperty = currentProperty.items; } - return currentProperty.allowableValues; + return currentProperty == null ? new HashMap() : currentProperty.allowableValues; } @@ -1855,16 +1855,18 @@ public class DefaultCodegen { || Boolean.TRUE.equals(baseItem.isListContainer))) { baseItem = baseItem.items; } - // set both datatype and datetypeWithEnum as only the inner type is enum - property.datatypeWithEnum = property.datatypeWithEnum.replace(baseItem.baseType, toEnumName(baseItem)); + if (baseItem != null) { + // set both datatype and datetypeWithEnum as only the inner type is enum + property.datatypeWithEnum = property.datatypeWithEnum.replace(baseItem.baseType, toEnumName(baseItem)); - // naming the enum with respect to the language enum naming convention - // e.g. remove [], {} from array/map of enum - property.enumName = toEnumName(property); + // naming the enum with respect to the language enum naming convention + // e.g. remove [], {} from array/map of enum + property.enumName = toEnumName(property); - // set default value for variable with inner enum - if (property.defaultValue != null) { - property.defaultValue = property.defaultValue.replace(baseItem.baseType, toEnumName(baseItem)); + // set default value for variable with inner enum + if (property.defaultValue != null) { + property.defaultValue = property.defaultValue.replace(baseItem.baseType, toEnumName(baseItem)); + } } } @@ -1878,16 +1880,19 @@ public class DefaultCodegen { || Boolean.TRUE.equals(baseItem.isListContainer))) { baseItem = baseItem.items; } - // set both datatype and datetypeWithEnum as only the inner type is enum - property.datatypeWithEnum = property.datatypeWithEnum.replace(", " + baseItem.baseType, ", " + toEnumName(baseItem)); - // naming the enum with respect to the language enum naming convention - // e.g. remove [], {} from array/map of enum - property.enumName = toEnumName(property); + if (baseItem != null) { + // set both datatype and datetypeWithEnum as only the inner type is enum + property.datatypeWithEnum = property.datatypeWithEnum.replace(", " + baseItem.baseType, ", " + toEnumName(baseItem)); - // set default value for variable with inner enum - if (property.defaultValue != null) { - property.defaultValue = property.defaultValue.replace(", " + property.items.baseType, ", " + toEnumName(property.items)); + // naming the enum with respect to the language enum naming convention + // e.g. remove [], {} from array/map of enum + property.enumName = toEnumName(property); + + // set default value for variable with inner enum + if (property.defaultValue != null) { + property.defaultValue = property.defaultValue.replace(", " + property.items.baseType, ", " + toEnumName(property.items)); + } } } diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.service.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.service.mustache index 64fb87eea93..d5286d6619c 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.service.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.service.mustache @@ -246,7 +246,8 @@ export class {{classname}} { {{#isResponseFile}} responseType: ResponseContentType.Blob, {{/isResponseFile}} - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 diff --git a/samples/client/petstore/typescript-angular2/default/api/pet.service.ts b/samples/client/petstore/typescript-angular2/default/api/pet.service.ts index b20b8b26969..91b9bac6ab2 100644 --- a/samples/client/petstore/typescript-angular2/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular2/default/api/pet.service.ts @@ -239,7 +239,8 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -289,7 +290,8 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -337,7 +339,8 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -385,7 +388,8 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -437,7 +441,8 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -482,7 +487,8 @@ export class PetService { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -549,7 +555,8 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: formParams, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -617,7 +624,8 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: formParams, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 diff --git a/samples/client/petstore/typescript-angular2/default/api/store.service.ts b/samples/client/petstore/typescript-angular2/default/api/store.service.ts index 5f67831b2cc..fc49f7eb64a 100644 --- a/samples/client/petstore/typescript-angular2/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular2/default/api/store.service.ts @@ -162,7 +162,8 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -199,7 +200,8 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -237,7 +239,8 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -273,7 +276,8 @@ export class StoreService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 diff --git a/samples/client/petstore/typescript-angular2/default/api/user.service.ts b/samples/client/petstore/typescript-angular2/default/api/user.service.ts index a18694e7fa0..26eeda66a2d 100644 --- a/samples/client/petstore/typescript-angular2/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular2/default/api/user.service.ts @@ -226,7 +226,8 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -262,7 +263,8 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -298,7 +300,8 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -336,7 +339,8 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -374,7 +378,8 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -416,7 +421,8 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -448,7 +454,8 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -490,7 +497,8 @@ export class UserService { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 diff --git a/samples/client/petstore/typescript-angular2/npm/README.md b/samples/client/petstore/typescript-angular2/npm/README.md index 7a5dc205e40..8995d86b5d7 100644 --- a/samples/client/petstore/typescript-angular2/npm/README.md +++ b/samples/client/petstore/typescript-angular2/npm/README.md @@ -1,4 +1,4 @@ -## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201704172305 +## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201704231833 ### Building @@ -19,7 +19,7 @@ navigate to the folder of your consuming project and run one of next commando's. _published:_ ``` -npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201704172305 --save +npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201704231833 --save ``` _unPublished (not recommended):_ diff --git a/samples/client/petstore/typescript-angular2/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular2/npm/api/pet.service.ts index b20b8b26969..91b9bac6ab2 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/pet.service.ts @@ -239,7 +239,8 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -289,7 +290,8 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -337,7 +339,8 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -385,7 +388,8 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -437,7 +441,8 @@ export class PetService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -482,7 +487,8 @@ export class PetService { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -549,7 +555,8 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: formParams, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -617,7 +624,8 @@ export class PetService { method: RequestMethod.Post, headers: headers, body: formParams, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 diff --git a/samples/client/petstore/typescript-angular2/npm/api/store.service.ts b/samples/client/petstore/typescript-angular2/npm/api/store.service.ts index 5f67831b2cc..fc49f7eb64a 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/store.service.ts @@ -162,7 +162,8 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -199,7 +200,8 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -237,7 +239,8 @@ export class StoreService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -273,7 +276,8 @@ export class StoreService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 diff --git a/samples/client/petstore/typescript-angular2/npm/api/user.service.ts b/samples/client/petstore/typescript-angular2/npm/api/user.service.ts index a18694e7fa0..26eeda66a2d 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/user.service.ts @@ -226,7 +226,8 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -262,7 +263,8 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -298,7 +300,8 @@ export class UserService { method: RequestMethod.Post, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -336,7 +339,8 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Delete, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -374,7 +378,8 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -416,7 +421,8 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -448,7 +454,8 @@ export class UserService { let requestOptions: RequestOptionsArgs = new RequestOptions({ method: RequestMethod.Get, headers: headers, - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 @@ -490,7 +497,8 @@ export class UserService { method: RequestMethod.Put, headers: headers, body: body == null ? '' : JSON.stringify(body), // https://github.com/angular/angular/issues/10612 - search: queryParameters + search: queryParameters, + withCredentials:true }); // https://github.com/swagger-api/swagger-codegen/issues/4037 diff --git a/samples/client/petstore/typescript-angular2/npm/package.json b/samples/client/petstore/typescript-angular2/npm/package.json index c8fb9bf1671..a1973c26f98 100644 --- a/samples/client/petstore/typescript-angular2/npm/package.json +++ b/samples/client/petstore/typescript-angular2/npm/package.json @@ -1,6 +1,6 @@ { "name": "@swagger/angular2-typescript-petstore", - "version": "0.0.1-SNAPSHOT.201704172305", + "version": "0.0.1-SNAPSHOT.201704231833", "description": "swagger client for @swagger/angular2-typescript-petstore", "author": "Swagger Codegen Contributors", "keywords": [