Fix path scoped annotation on service resources #984
Merged
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.
Backend scoped annotations apply just once per service resource, and have the most precedence. With this behavior in mind, service annotations were being applied along with the annotation mapper creation. This works nice with backend scoped annotations.
Path scoped, however, has the ability to apply distinct values to the same backend. When path scoped annotations are applied via a service resource, only the first path is being applied, along with annotation mapper creation. This update ensures that the service annotations are applied on every pathlink that points to it. This change will spread service annotations over all referenced pathlinks, however this doesn't end up with duplicated configurations because the config builder already deduplicates configurations on the same key, with the same value, to the same backend. Warning on annotation conflict isn't a problem as well, a conflict is only warned on distinct values.