Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue where collection generation took very large time. #735

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

VShingala
Copy link
Member

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 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.

@VShingala VShingala merged commit b9bf427 into develop Jun 12, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants