Don't regenerate operation_id in MockResolver#1999
Open
RobbeSneyders wants to merge 1 commit intomainfrom
Open
Don't regenerate operation_id in MockResolver#1999RobbeSneyders wants to merge 1 commit intomainfrom
RobbeSneyders wants to merge 1 commit intomainfrom
Conversation
Ruwann
previously approved these changes
Nov 20, 2024
Member
Ruwann
left a comment
There was a problem hiding this comment.
Thanks, left a minor (optional) comment.
Can we add a test for this? Doubting whether it is overkill to do this for the benefit we'll get from a test for the mock resolver but if only for the resolver, a test should be that hard to add?
| if operation_id is None: | ||
| operation_ref = operation.path + operation.method | ||
| if operation_ref in self._resolved_operations: | ||
| operation_id = self._resolved_operations.get(operation_ref) |
Member
There was a problem hiding this comment.
In this branch, we know it exists, so we should be able to directly use access by key?
Member
Author
|
Looking into adding a test makes me doubt if this is the right way to resolve this issue. We are creating a new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the same operation was being resolved multiple times (eg. in different middleware), a new mock operation_id was generated every time, breaking routing for these mocked operations.
This PR keeps track of the generated operation_ids and returns a previously generated id if the same operation is resolved.
CC: @julienschuermans