[TypeScript][Node] Resolve TS2532 error (#6932)

* [TypeScript][Node] Resolve TS2532 error

* Run `bin/typescript-node-petstore-all.sh`

* Run `bin/security/typescript-node.sh`
This commit is contained in:
Shuma Yoshioka 2017-11-13 12:23:56 +09:00 committed by William Cheng
parent 4a38ee283c
commit 053061ec9f
11 changed files with 2109 additions and 441 deletions

View File

@ -448,7 +448,7 @@ export class {{classname}} {
{{#returnType}}
body = ObjectSerializer.deserialize(body, "{{{returnType}}}");
{{/returnType}}
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });

View File

@ -10,7 +10,7 @@
* Do not edit the class manually.
*/
import request = require('request');
import localVarRequest = require('request');
import http = require('http');
import Promise = require('bluebird');
@ -171,13 +171,13 @@ export interface Authentication {
/**
* Apply authentication settings to header and query params.
*/
applyToRequest(requestOptions: request.Options): void;
applyToRequest(requestOptions: localVarRequest.Options): void;
}
export class HttpBasicAuth implements Authentication {
public username: string;
public password: string;
applyToRequest(requestOptions: request.Options): void {
applyToRequest(requestOptions: localVarRequest.Options): void {
requestOptions.auth = {
username: this.username, password: this.password
}
@ -190,7 +190,7 @@ export class ApiKeyAuth implements Authentication {
constructor(private location: string, private paramName: string) {
}
applyToRequest(requestOptions: request.Options): void {
applyToRequest(requestOptions: localVarRequest.Options): void {
if (this.location == "query") {
(<any>requestOptions.qs)[this.paramName] = this.apiKey;
} else if (this.location == "header" && requestOptions && requestOptions.headers) {
@ -202,7 +202,7 @@ export class ApiKeyAuth implements Authentication {
export class OAuth implements Authentication {
public accessToken: string;
applyToRequest(requestOptions: request.Options): void {
applyToRequest(requestOptions: localVarRequest.Options): void {
if (requestOptions && requestOptions.headers) {
requestOptions.headers["Authorization"] = "Bearer " + this.accessToken;
}
@ -212,7 +212,7 @@ export class OAuth implements Authentication {
export class VoidAuth implements Authentication {
public username: string;
public password: string;
applyToRequest(_: request.Options): void {
applyToRequest(_: localVarRequest.Options): void {
// Do nothing
}
}
@ -275,41 +275,41 @@ export class FakeApi {
*/
public testCodeInjectEndRnNR (test code inject * &#39; &quot; &#x3D;end rn n r?: string) : Promise<{ response: http.ClientResponse; body?: any; }> {
const localVarPath = this.basePath + '/fake';
let queryParameters: any = {};
let headerParams: any = (<any>Object).assign({}, this.defaultHeaders);
let formParams: any = {};
let localVarQueryParameters: any = {};
let localVarHeaderParams: any = (<any>Object).assign({}, this.defaultHeaders);
let localVarFormParams: any = {};
let useFormData = false;
let localVarUseFormData = false;
if (test code inject * &#39; &quot; &#x3D;end rn n r !== undefined) {
formParams['test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r'] = ObjectSerializer.serialize(test code inject * &#39; &quot; &#x3D;end rn n r, "string");
localVarFormParams['test code inject */ &#39; &quot; &#x3D;end -- \r\n \n \r'] = ObjectSerializer.serialize(test code inject * &#39; &quot; &#x3D;end rn n r, "string");
}
let requestOptions: request.Options = {
let localVarRequestOptions: localVarRequest.Options = {
method: 'PUT',
qs: queryParameters,
headers: headerParams,
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
this.authentications.default.applyToRequest(requestOptions);
this.authentications.default.applyToRequest(localVarRequestOptions);
if (Object.keys(formParams).length) {
if (useFormData) {
(<any>requestOptions).formData = formParams;
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
(<any>localVarRequestOptions).formData = localVarFormParams;
} else {
requestOptions.form = formParams;
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise<{ response: http.ClientResponse; body?: any; }>((resolve, reject) => {
request(requestOptions, (error, response, body) => {
localVarRequest(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });

View File

@ -566,7 +566,7 @@ export class PetApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -622,7 +622,7 @@ export class PetApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -680,7 +680,7 @@ export class PetApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "Array<Pet>");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -738,7 +738,7 @@ export class PetApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "Array<Pet>");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -793,7 +793,7 @@ export class PetApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "Pet");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -847,7 +847,7 @@ export class PetApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -911,7 +911,7 @@ export class PetApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -977,7 +977,7 @@ export class PetApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "ApiResponse");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1081,7 +1081,7 @@ export class StoreApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1129,7 +1129,7 @@ export class StoreApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "{ [key: string]: number; }");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1182,7 +1182,7 @@ export class StoreApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "Order");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1235,7 +1235,7 @@ export class StoreApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "Order");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1339,7 +1339,7 @@ export class UserApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1391,7 +1391,7 @@ export class UserApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1443,7 +1443,7 @@ export class UserApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1495,7 +1495,7 @@ export class UserApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1548,7 +1548,7 @@ export class UserApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "User");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1614,7 +1614,7 @@ export class UserApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "string");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1659,7 +1659,7 @@ export class UserApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1718,7 +1718,7 @@ export class UserApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });

View File

@ -1,6 +1,22 @@
import request = require('request');
import localVarRequest = require('request');
import http = require('http');
import Promise = require('bluebird');
export declare class ApiResponse {
'code': number;
'type': string;
'message': string;
static discriminator: any;
static attributeTypeMap: Array<{
name: string;
baseName: string;
type: string;
}>;
static getAttributeTypeMap(): {
name: string;
baseName: string;
type: string;
}[];
}
export declare class Category {
'id': number;
'name': string;
@ -105,34 +121,34 @@ export declare class User {
}[];
}
export interface Authentication {
applyToRequest(requestOptions: request.Options): void;
applyToRequest(requestOptions: localVarRequest.Options): void;
}
export declare class HttpBasicAuth implements Authentication {
username: string;
password: string;
applyToRequest(requestOptions: request.Options): void;
applyToRequest(requestOptions: localVarRequest.Options): void;
}
export declare class ApiKeyAuth implements Authentication {
private location;
private paramName;
apiKey: string;
constructor(location: string, paramName: string);
applyToRequest(requestOptions: request.Options): void;
applyToRequest(requestOptions: localVarRequest.Options): void;
}
export declare class OAuth implements Authentication {
accessToken: string;
applyToRequest(requestOptions: request.Options): void;
applyToRequest(requestOptions: localVarRequest.Options): void;
}
export declare class VoidAuth implements Authentication {
username: string;
password: string;
applyToRequest(_: request.Options): void;
applyToRequest(_: localVarRequest.Options): void;
}
export declare enum PetApiApiKeys {
api_key = 0,
}
export declare class PetApi {
protected basePath: string;
protected _basePath: string;
protected defaultHeaders: any;
protected _useQuerystring: boolean;
protected authentications: {
@ -142,10 +158,11 @@ export declare class PetApi {
};
constructor(basePath?: string);
useQuerystring: boolean;
basePath: string;
setDefaultAuthentication(auth: Authentication): void;
setApiKey(key: PetApiApiKeys, value: string): void;
accessToken: string;
private extendObj<T1, T2>(objA, objB);
addPet(body?: Pet): Promise<{
addPet(body: Pet): Promise<{
response: http.ClientResponse;
body?: any;
}>;
@ -153,11 +170,11 @@ export declare class PetApi {
response: http.ClientResponse;
body?: any;
}>;
findPetsByStatus(status?: Array<string>): Promise<{
findPetsByStatus(status: Array<string>): Promise<{
response: http.ClientResponse;
body: Array<Pet>;
}>;
findPetsByTags(tags?: Array<string>): Promise<{
findPetsByTags(tags: Array<string>): Promise<{
response: http.ClientResponse;
body: Array<Pet>;
}>;
@ -165,24 +182,24 @@ export declare class PetApi {
response: http.ClientResponse;
body: Pet;
}>;
updatePet(body?: Pet): Promise<{
updatePet(body: Pet): Promise<{
response: http.ClientResponse;
body?: any;
}>;
updatePetWithForm(petId: string, name?: string, status?: string): Promise<{
updatePetWithForm(petId: number, name?: string, status?: string): Promise<{
response: http.ClientResponse;
body?: any;
}>;
uploadFile(petId: number, additionalMetadata?: string, file?: any): Promise<{
uploadFile(petId: number, additionalMetadata?: string, file?: Buffer): Promise<{
response: http.ClientResponse;
body?: any;
body: ApiResponse;
}>;
}
export declare enum StoreApiApiKeys {
api_key = 0,
}
export declare class StoreApi {
protected basePath: string;
protected _basePath: string;
protected defaultHeaders: any;
protected _useQuerystring: boolean;
protected authentications: {
@ -192,9 +209,10 @@ export declare class StoreApi {
};
constructor(basePath?: string);
useQuerystring: boolean;
basePath: string;
setDefaultAuthentication(auth: Authentication): void;
setApiKey(key: StoreApiApiKeys, value: string): void;
accessToken: string;
private extendObj<T1, T2>(objA, objB);
deleteOrder(orderId: string): Promise<{
response: http.ClientResponse;
body?: any;
@ -205,11 +223,11 @@ export declare class StoreApi {
[key: string]: number;
};
}>;
getOrderById(orderId: string): Promise<{
getOrderById(orderId: number): Promise<{
response: http.ClientResponse;
body: Order;
}>;
placeOrder(body?: Order): Promise<{
placeOrder(body: Order): Promise<{
response: http.ClientResponse;
body: Order;
}>;
@ -218,7 +236,7 @@ export declare enum UserApiApiKeys {
api_key = 0,
}
export declare class UserApi {
protected basePath: string;
protected _basePath: string;
protected defaultHeaders: any;
protected _useQuerystring: boolean;
protected authentications: {
@ -228,18 +246,19 @@ export declare class UserApi {
};
constructor(basePath?: string);
useQuerystring: boolean;
basePath: string;
setDefaultAuthentication(auth: Authentication): void;
setApiKey(key: UserApiApiKeys, value: string): void;
accessToken: string;
private extendObj<T1, T2>(objA, objB);
createUser(body?: User): Promise<{
createUser(body: User): Promise<{
response: http.ClientResponse;
body?: any;
}>;
createUsersWithArrayInput(body?: Array<User>): Promise<{
createUsersWithArrayInput(body: Array<User>): Promise<{
response: http.ClientResponse;
body?: any;
}>;
createUsersWithListInput(body?: Array<User>): Promise<{
createUsersWithListInput(body: Array<User>): Promise<{
response: http.ClientResponse;
body?: any;
}>;
@ -251,7 +270,7 @@ export declare class UserApi {
response: http.ClientResponse;
body: User;
}>;
loginUser(username?: string, password?: string): Promise<{
loginUser(username: string, password: string): Promise<{
response: http.ClientResponse;
body: string;
}>;
@ -259,7 +278,7 @@ export declare class UserApi {
response: http.ClientResponse;
body?: any;
}>;
updateUser(username: string, body?: User): Promise<{
updateUser(username: string, body: User): Promise<{
response: http.ClientResponse;
body?: any;
}>;

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -566,7 +566,7 @@ export class PetApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -622,7 +622,7 @@ export class PetApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -680,7 +680,7 @@ export class PetApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "Array<Pet>");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -738,7 +738,7 @@ export class PetApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "Array<Pet>");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -793,7 +793,7 @@ export class PetApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "Pet");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -847,7 +847,7 @@ export class PetApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -911,7 +911,7 @@ export class PetApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -977,7 +977,7 @@ export class PetApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "ApiResponse");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1081,7 +1081,7 @@ export class StoreApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1129,7 +1129,7 @@ export class StoreApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "{ [key: string]: number; }");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1182,7 +1182,7 @@ export class StoreApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "Order");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1235,7 +1235,7 @@ export class StoreApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "Order");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1339,7 +1339,7 @@ export class UserApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1391,7 +1391,7 @@ export class UserApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1443,7 +1443,7 @@ export class UserApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1495,7 +1495,7 @@ export class UserApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1548,7 +1548,7 @@ export class UserApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "User");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1614,7 +1614,7 @@ export class UserApi {
reject(error);
} else {
body = ObjectSerializer.deserialize(body, "string");
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1659,7 +1659,7 @@ export class UserApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });
@ -1718,7 +1718,7 @@ export class UserApi {
if (error) {
reject(error);
} else {
if (response.statusCode >= 200 && response.statusCode <= 299) {
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
resolve({ response: response, body: body });
} else {
reject({ response: response, body: body });

View File

@ -4,9 +4,9 @@ var fs = require('fs');
function deepCheck(objectA, objectB) {
var a = objectA;
var b = objectB;
var isString = (typeof a == "string" && typeof b == "string");
var isBool = (typeof a == "boolean" && typeof b == "boolean");
var isNumber = (typeof a == "number" && typeof b == "number");
var isString = (typeof a === "string" && typeof b === "string");
var isBool = (typeof a === "boolean" && typeof b === "boolean");
var isNumber = (typeof a === "number" && typeof b === "number");
if (a instanceof Array && b instanceof Array) {
for (var i = 0; i < a.length; i++) {
if (!deepCheck(a[i], b[i])) {
@ -18,7 +18,7 @@ function deepCheck(objectA, objectB) {
else if (isString || isBool || isNumber) {
return a === b;
}
else if (typeof a == "object" && typeof b == "object") {
else if (typeof a === "object" && typeof b === "object") {
for (var key in a) {
if (!deepCheck(a[key], b[key])) {
return false;
@ -114,7 +114,7 @@ petApi.addPet(pet)
})
.then(function (res) {
console.log('Updated pet using POST form');
return petApi.uploadFile(petId, undefined, fs.createReadStream('sample.png'));
return petApi.uploadFile(petId, undefined, fs.readFileSync('sample.png'));
})
.then(function (res) {
console.log('Uploaded image');

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -24,4 +24,4 @@
"publishConfig": {
"registry": "https://skimdb.npmjs.com/registry"
}
}
}