This PR fixes issue where certain definition were taking very large amount of time to generate collection. Specifically this was happening when parametersResolution option is set to Schema. When set to Schema conversion was taking >4 mins or so, meanwhile using example only took ~4 sec to convert.
RCA
Upon further debugging, I found out that all time taken was by json-schema-faker library. And also, that too when corresponding schema that was being faked contained uniqueItems: true constraint.
When uniqueItems set to true, json-schema-faker library goes through faked data and tries to compare all items in array and only adds unique items to array. And in cases of very large and complex arrays, this process of comparison takes large amount of times especially when Schema as value to the option parametersResolution is used because essentially all items in array would be same and this comparison has to go through all data in the array.
As for Example value this process doesn't take long because at very starting of any array, some value will be unique due to random faked data. So process doesn't go through all elements of item.
Fix
We'll be not going through the process of determining all items to be unique in case when parametersResolution is set to Schema.
Overview
This PR fixes issue where certain definition were taking very large amount of time to generate collection. Specifically this was happening when
parametersResolution
option is set toSchema
. When set toSchema
conversion was taking >4 mins or so, meanwhile usingexample
only took ~4 sec to convert.RCA
Upon further debugging, I found out that all time taken was by
json-schema-faker
library. And also, that too when corresponding schema that was being faked containeduniqueItems: true
constraint.When
uniqueItems
set to true,json-schema-faker
library goes through faked data and tries to compare all items in array and only adds unique items to array. And in cases of very large and complex arrays, this process of comparison takes large amount of times especially whenSchema
as value to the optionparametersResolution
is used because essentially all items in array would be same and this comparison has to go through all data in the array.As for
Example
value this process doesn't take long because at very starting of any array, some value will be unique due to random faked data. So process doesn't go through all elements of item.Fix
We'll be not going through the process of determining all items to be unique in case when
parametersResolution
is set toSchema
.