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

fix wildcard rules are not reusable #1459

Merged
merged 1 commit into from
Oct 7, 2022

Conversation

tbrockmeyer-a
Copy link
Contributor

@tbrockmeyer-a tbrockmeyer-a commented Oct 4, 2022

Summary:

Fixes #1358
Fixes #1341
(slightly different problems with the same root cause)

When using wildcard rules, it was not possible to reuse the same object that had the '*' key defined in it.

Cause:

Line 142: delete rules['*'] was modifying the argument to the function (which is sort of an anti-pattern for this kind of reason) and was causing subsequent uses of the same object to not have the wildcard rule for their own usage.

The issue that I was facing was that if you attempt to apply the middleware to a schema two or more times, it only has the wildcard rules for the first invocation. I've determined that the line above is the root cause of both issues.

Testing:

I have added a test (a copy of the wildcard test, but with a double usage to cause the error to occur). It was correctly failing prior to the fix, and began passing after the fix was added.

@tbrockmeyer-a
Copy link
Contributor Author

Hi,

Because all of the checks have passed, I'd like to get a review at your earliest convenience so that we can get this merged. Thanks :D

@tbrockmeyer-a
Copy link
Contributor Author

Hey, I'm pinging for visibility. Just need a review :)

Copy link
Collaborator

@dimatill dimatill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, thank you @tbrockmeyer-a !

@dimatill dimatill merged commit 592fa39 into maticzav:master Oct 7, 2022
@tbrockmeyer-a tbrockmeyer-a deleted the fix-wildcard-reuse branch October 24, 2022 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants