typescript-jquery: Update to work with Typescript strict mode (#3969)

* typescript-jquery: Work in Typescript strict mode

* re-generate samples
This commit is contained in:
Jan Jongboom 2019-10-21 17:14:48 +05:30 committed by Esteban Gehring
parent ea76a94001
commit 1052ebaced
16 changed files with 30 additions and 159 deletions

View File

@ -5,6 +5,6 @@ If Not Exist %executable% (
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -c bin\typescript-petstore-npm.json -g typescript-jquery -o samples\client\petstore\typescript-jquery\npm
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -c bin\typescript-jquery-petstore-npm.json -g typescript-jquery -o samples\client\petstore\typescript-jquery\npm
java %JAVA_OPTS% -jar %executable% %ags%

View File

@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
export class {{classname}} {
protected basePath = '{{{basePath}}}';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = undefined;
public configuration: Configuration = new Configuration();
constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
@ -37,7 +37,7 @@ export class {{classname}} {
}
}
private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
private extendObj<T1 extends object, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];

View File

@ -1,6 +1,6 @@
export class Configuration {
apiKey: string;
username: string;
password: string;
accessToken: string | (() => string);
apiKey: string | undefined;
username: string | undefined;
password: string | undefined;
accessToken: string | (() => string) | undefined;
}

View File

@ -1,11 +1,11 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):

View File

@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
export class PetApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = undefined;
public configuration: Configuration = new Configuration();
constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
@ -37,7 +37,7 @@ export class PetApi {
}
}
private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
private extendObj<T1 extends object, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];

View File

@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
export class StoreApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = undefined;
public configuration: Configuration = new Configuration();
constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
@ -37,7 +37,7 @@ export class StoreApi {
}
}
private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
private extendObj<T1 extends object, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];

View File

@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
export class UserApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = undefined;
public configuration: Configuration = new Configuration();
constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
@ -37,7 +37,7 @@ export class UserApi {
}
}
private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
private extendObj<T1 extends object, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];

View File

@ -1,6 +1,6 @@
export class Configuration {
apiKey: string;
username: string;
password: string;
accessToken: string | (() => string);
apiKey: string | undefined;
username: string | undefined;
password: string | undefined;
accessToken: string | (() => string) | undefined;
}

View File

@ -1,26 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
/**
* some description
*/
export interface Amount {
/**
* some description
*/
value: number;
currency: models.Currency;
}

View File

@ -1,19 +0,0 @@
/**
* Swagger Petstore
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
* Contact: apiteam@swagger.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
import * as models from './models';
/**
* some description
*/
export interface Currency {
}

View File

@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
export class PetApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = undefined;
public configuration: Configuration = new Configuration();
constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
@ -37,7 +37,7 @@ export class PetApi {
}
}
private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
private extendObj<T1 extends object, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];

View File

@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
export class StoreApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = undefined;
public configuration: Configuration = new Configuration();
constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
@ -37,7 +37,7 @@ export class StoreApi {
}
}
private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
private extendObj<T1 extends object, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];

View File

@ -22,7 +22,7 @@ import { Configuration } from '../configuration';
export class UserApi {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders: Array<string> = [];
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = null;
public defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings = undefined;
public configuration: Configuration = new Configuration();
constructor(basePath?: string, configuration?: Configuration, defaultExtraJQueryAjaxSettings?: JQueryAjaxSettings) {
@ -37,7 +37,7 @@ export class UserApi {
}
}
private extendObj<T1, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
private extendObj<T1 extends object, T2 extends T1>(objA: T2, objB: T2): T1|T2 {
for (let key in objB) {
if (objB.hasOwnProperty(key)) {
objA[key] = objB[key];

View File

@ -1,6 +1,6 @@
export class Configuration {
apiKey: string;
username: string;
password: string;
accessToken: string | (() => string);
apiKey: string | undefined;
username: string | undefined;
password: string | undefined;
accessToken: string | (() => string) | undefined;
}

View File

@ -1,42 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export class InlineObject {
/**
* Updated name of the pet
*/
'name'?: string;
/**
* Updated status of the pet
*/
'status'?: string;
static discriminator: string | undefined = undefined;
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "name",
"baseName": "name",
"type": "string"
},
{
"name": "status",
"baseName": "status",
"type": "string"
} ];
static getAttributeTypeMap() {
return InlineObject.attributeTypeMap;
}
}

View File

@ -1,42 +0,0 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export class InlineObject1 {
/**
* Additional data to pass to server
*/
'additionalMetadata'?: string;
/**
* file to upload
*/
'file'?: Buffer;
static discriminator: string | undefined = undefined;
static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
"name": "additionalMetadata",
"baseName": "additionalMetadata",
"type": "string"
},
{
"name": "file",
"baseName": "file",
"type": "Buffer"
} ];
static getAttributeTypeMap() {
return InlineObject1.attributeTypeMap;
}
}