@har-sdk/openapi-sampler
Version:
[](https://codeclimate.com/github/NeuraLegion/har-sdk/maintainability) [ {
this.traverse = traverse;
}
sample(schema, spec, options) {
let arrayLength = schema.minItems || 1;
if (hasItems(schema) && Array.isArray(schema.items)) {
arrayLength = Math.max(arrayLength, schema.items.length);
}
const itemSchemaGetter = (itemNumber) => {
if (hasItems(schema) && Array.isArray(schema.items)) {
return schema.items[itemNumber] || {};
}
return hasItems(schema) ? schema.items : {};
};
const res = [];
if (!hasItems(schema)) {
return res;
}
for (let i = 0; i < arrayLength; i++) {
const itemSchema = itemSchemaGetter(i);
res.push(this.traverse.traverse(itemSchema, options, spec).value);
}
return res;
}
}
//# sourceMappingURL=ArraySampler.js.map