[Typescript] Use for of instead of for in at ObjectSerializer (#14849)

* [Typescript] Use for of instead of for in

* fix for

* regenerate samples
This commit is contained in:
Kuzma 2023-03-02 00:16:01 +03:00 committed by GitHub
parent 2458743257
commit c8fab3f40a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 72 deletions

View File

@ -101,8 +101,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.serialize(date, subType, format)); transformedData.push(ObjectSerializer.serialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -131,8 +130,7 @@ export class ObjectSerializer {
// get the map for the correct type. // get the map for the correct type.
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
let instance: {[index: string]: any} = {}; let instance: {[index: string]: any} = {};
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format);
} }
return instance; return instance;
@ -150,8 +148,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.deserialize(date, subType, format)); transformedData.push(ObjectSerializer.deserialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -167,8 +164,7 @@ export class ObjectSerializer {
} }
let instance = new typeMap[type](); let instance = new typeMap[type]();
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format); let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format);
if (value !== undefined) { if (value !== undefined) {
instance[attributeType.name] = value; instance[attributeType.name] = value;

View File

@ -73,8 +73,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.serialize(date, subType, format)); transformedData.push(ObjectSerializer.serialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -103,8 +102,7 @@ export class ObjectSerializer {
// get the map for the correct type. // get the map for the correct type.
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
let instance: {[index: string]: any} = {}; let instance: {[index: string]: any} = {};
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format);
} }
return instance; return instance;
@ -122,8 +120,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.deserialize(date, subType, format)); transformedData.push(ObjectSerializer.deserialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -139,8 +136,7 @@ export class ObjectSerializer {
} }
let instance = new typeMap[type](); let instance = new typeMap[type]();
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format); let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format);
if (value !== undefined) { if (value !== undefined) {
instance[attributeType.name] = value; instance[attributeType.name] = value;

View File

@ -90,8 +90,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.serialize(date, subType, format)); transformedData.push(ObjectSerializer.serialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -120,8 +119,7 @@ export class ObjectSerializer {
// get the map for the correct type. // get the map for the correct type.
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
let instance: {[index: string]: any} = {}; let instance: {[index: string]: any} = {};
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format);
} }
return instance; return instance;
@ -139,8 +137,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.deserialize(date, subType, format)); transformedData.push(ObjectSerializer.deserialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -156,8 +153,7 @@ export class ObjectSerializer {
} }
let instance = new typeMap[type](); let instance = new typeMap[type]();
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format); let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format);
if (value !== undefined) { if (value !== undefined) {
instance[attributeType.name] = value; instance[attributeType.name] = value;

View File

@ -102,8 +102,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.serialize(date, subType, format)); transformedData.push(ObjectSerializer.serialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -132,8 +131,7 @@ export class ObjectSerializer {
// get the map for the correct type. // get the map for the correct type.
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
let instance: {[index: string]: any} = {}; let instance: {[index: string]: any} = {};
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format);
} }
return instance; return instance;
@ -151,8 +149,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.deserialize(date, subType, format)); transformedData.push(ObjectSerializer.deserialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -168,8 +165,7 @@ export class ObjectSerializer {
} }
let instance = new typeMap[type](); let instance = new typeMap[type]();
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format); let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format);
if (value !== undefined) { if (value !== undefined) {
instance[attributeType.name] = value; instance[attributeType.name] = value;

View File

@ -90,8 +90,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.serialize(date, subType, format)); transformedData.push(ObjectSerializer.serialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -120,8 +119,7 @@ export class ObjectSerializer {
// get the map for the correct type. // get the map for the correct type.
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
let instance: {[index: string]: any} = {}; let instance: {[index: string]: any} = {};
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format);
} }
return instance; return instance;
@ -139,8 +137,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.deserialize(date, subType, format)); transformedData.push(ObjectSerializer.deserialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -156,8 +153,7 @@ export class ObjectSerializer {
} }
let instance = new typeMap[type](); let instance = new typeMap[type]();
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format); let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format);
if (value !== undefined) { if (value !== undefined) {
instance[attributeType.name] = value; instance[attributeType.name] = value;

View File

@ -90,8 +90,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.serialize(date, subType, format)); transformedData.push(ObjectSerializer.serialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -120,8 +119,7 @@ export class ObjectSerializer {
// get the map for the correct type. // get the map for the correct type.
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
let instance: {[index: string]: any} = {}; let instance: {[index: string]: any} = {};
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format);
} }
return instance; return instance;
@ -139,8 +137,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.deserialize(date, subType, format)); transformedData.push(ObjectSerializer.deserialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -156,8 +153,7 @@ export class ObjectSerializer {
} }
let instance = new typeMap[type](); let instance = new typeMap[type]();
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format); let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format);
if (value !== undefined) { if (value !== undefined) {
instance[attributeType.name] = value; instance[attributeType.name] = value;

View File

@ -90,8 +90,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.serialize(date, subType, format)); transformedData.push(ObjectSerializer.serialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -120,8 +119,7 @@ export class ObjectSerializer {
// get the map for the correct type. // get the map for the correct type.
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
let instance: {[index: string]: any} = {}; let instance: {[index: string]: any} = {};
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format);
} }
return instance; return instance;
@ -139,8 +137,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.deserialize(date, subType, format)); transformedData.push(ObjectSerializer.deserialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -156,8 +153,7 @@ export class ObjectSerializer {
} }
let instance = new typeMap[type](); let instance = new typeMap[type]();
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format); let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format);
if (value !== undefined) { if (value !== undefined) {
instance[attributeType.name] = value; instance[attributeType.name] = value;

View File

@ -90,8 +90,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.serialize(date, subType, format)); transformedData.push(ObjectSerializer.serialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -120,8 +119,7 @@ export class ObjectSerializer {
// get the map for the correct type. // get the map for the correct type.
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
let instance: {[index: string]: any} = {}; let instance: {[index: string]: any} = {};
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format);
} }
return instance; return instance;
@ -139,8 +137,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.deserialize(date, subType, format)); transformedData.push(ObjectSerializer.deserialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -156,8 +153,7 @@ export class ObjectSerializer {
} }
let instance = new typeMap[type](); let instance = new typeMap[type]();
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format); let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format);
if (value !== undefined) { if (value !== undefined) {
instance[attributeType.name] = value; instance[attributeType.name] = value;

View File

@ -90,8 +90,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.serialize(date, subType, format)); transformedData.push(ObjectSerializer.serialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -120,8 +119,7 @@ export class ObjectSerializer {
// get the map for the correct type. // get the map for the correct type.
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
let instance: {[index: string]: any} = {}; let instance: {[index: string]: any} = {};
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format); instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type, attributeType.format);
} }
return instance; return instance;
@ -139,8 +137,7 @@ export class ObjectSerializer {
let subType: string = type.replace("Array<", ""); // Array<Type> => Type> let subType: string = type.replace("Array<", ""); // Array<Type> => Type>
subType = subType.substring(0, subType.length - 1); // Type> => Type subType = subType.substring(0, subType.length - 1); // Type> => Type
let transformedData: any[] = []; let transformedData: any[] = [];
for (let index in data) { for (let date of data) {
let date = data[index];
transformedData.push(ObjectSerializer.deserialize(date, subType, format)); transformedData.push(ObjectSerializer.deserialize(date, subType, format));
} }
return transformedData; return transformedData;
@ -156,8 +153,7 @@ export class ObjectSerializer {
} }
let instance = new typeMap[type](); let instance = new typeMap[type]();
let attributeTypes = typeMap[type].getAttributeTypeMap(); let attributeTypes = typeMap[type].getAttributeTypeMap();
for (let index in attributeTypes) { for (let attributeType of attributeTypes) {
let attributeType = attributeTypes[index];
let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format); let value = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type, attributeType.format);
if (value !== undefined) { if (value !== undefined) {
instance[attributeType.name] = value; instance[attributeType.name] = value;