Add new report to track properties that get overwritten during flattening#3013
Merged
Conversation
Contributor
Does the PR have any schema changes?Looking good! No breaking changes found. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #3013 +/- ##
==========================================
+ Coverage 60.37% 60.41% +0.03%
==========================================
Files 65 65
Lines 10897 10912 +15
==========================================
+ Hits 6579 6592 +13
- Misses 3775 3777 +2
Partials 543 543 ☔ View full report in Codecov by Sentry. |
danielrbradley
approved these changes
Jan 11, 2024
danielrbradley
left a comment
Contributor
There was a problem hiding this comment.
Core change looks good. A couple of minor nits inline.
Also, can we add a brief explanation of the report to reports/README.md?
134949e to
e535245
Compare
thomas11
added a commit
that referenced
this pull request
Jan 8, 2025
Skip the flattening of nested properties indicated by [x-ms-client-flatten](https://github.com/Azure/autorest/blob/main/docs/extensions/readme.md#x-ms-client-flatten) if it would lead to overwriting a property, creating incorrect schema and SDKs. This case happens when inner and outer property have the same name. For a report on all occurrences see #3013. This change is breaking and could therefore only be applied to v3 of the provider. The PR is written to be reviewed commit by commit. It supersedes the previous #3801. **I recommend hiding whitespace when reviewing since the level of indentation of otherwise unaffected code changed.** Resolves #3195
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.
The Azure spec has an annotation x-ms-client-flatten which instructs the schema generator to flatten the property into the parent object. However, there are cases where this leads to overwriting a property, creating incorrect schema and SDKs, when inner and outer property have the same name. I discovered this problem accidentally. First step is to quantify, which this report is for.