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

Removed unnecessary options merging with each util function. #712

Merged
merged 4 commits into from
May 4, 2023

Conversation

VShingala
Copy link
Member

@VShingala VShingala commented May 3, 2023

Overview

This PR fixes issue where we were merging options when not needed due to all APIs now using SchemaPack which by default in it's constructor determines options to be used.

Ref:

this.computedOptions = utils.mergeOptions(

One of such instance was in getRefObject() which recursively resolves reference. This caused the merge operation to be done every single time a reference is resolved which is not required at all.

Apart from this, in cases when there were circular reference in non-schema $ref, we were resolving them without recursion break points. We'll be now making sure that we resolve circular $ref correctly.

We've removed all instance of merging of these options with default ones in SchemaUtils.js file and also fixed tests accordingly which were relying on this logic to be there.

@dhwaneetbhatt
Copy link
Contributor

@VShingala will this change be compatible with both v1 and v2 interface version?

@VShingala
Copy link
Member Author

@VShingala will this change be compatible with both v1 and v2 interface version?

@dhwaneetbhatt For v2 interface, we are not doing this and always using constuctor defined options always so this change is not needed for v2 interface.

@VShingala
Copy link
Member Author

@dhwaneetbhatt Will need a second review with latest change. I've also updated the description with second set of fix.

lib/schemaUtils.js Outdated Show resolved Hide resolved
Co-authored-by: Dhwaneet Bhatt <dhwaneet.bhatt@postman.com>
@VShingala VShingala merged commit 2be5cfb into develop May 4, 2023
2 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