Fix new property in request causes existing request show as modified in git sync [INS-4511] #8021
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.
Background
Currently, When we add a new property to models like Request, we will add the default value of this property in model init method. Otherwise the new property can not be updated due to current design in database.update method which will check if updated keys is valid.
But this will cause all existing models show as modified in git sync, due to current implementation of using YAML stringify method to compare local db content with git origin content. The YAML stringify method will add a new property to the yaml file even the value is undefined.
Solution
Instead of adding a new property to request, I have moved the logic to detect if a GraphQL request operation is subscription or not into request model, so no more extra property is needed