-
Notifications
You must be signed in to change notification settings - Fork 387
Honor exact C# names over back-compat naming #11663
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
Draft
Copilot
wants to merge
6
commits into
main
Choose a base branch
from
copilot/microsoft-11640-consider-exact-override-naming
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a6a25ce
Initial plan
Copilot 8000ad9
fix(http-client-csharp): honor exact names over back compat
Copilot 9cb77d7
test(http-client-csharp): expand exact-name backcompat coverage
Copilot 6ba30b8
fix(http-client-csharp): honor exact names in enum and ctor back compat
Copilot 73521ea
Merge origin/main into exact-name backcompat fix
Copilot f86f70e
chore(http-client-csharp): address review cleanup
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
9 changes: 9 additions & 0 deletions
9
...ntProviderTests/ExactParameterNameTakesPrecedenceOverLastContractView(Last)/TestClient.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| namespace Sample | ||
| { | ||
| public partial class TestClient | ||
| { | ||
| public void GetSomething(string oldParam) | ||
| { | ||
| } | ||
| } | ||
| } |
22 changes: 22 additions & 0 deletions
22
...TestData/RestClientProviderTests/ExactParameterNameTakesPrecedenceOverLastContractView.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // <auto-generated/> | ||
|
|
||
| #nullable disable | ||
|
|
||
| using System.ClientModel.Primitives; | ||
|
|
||
| namespace Sample | ||
| { | ||
| public partial class TestClient | ||
| { | ||
| internal global::System.ClientModel.Primitives.PipelineMessage CreateGetSomethingRequest(string exact_param, global::System.ClientModel.Primitives.RequestOptions options) | ||
| { | ||
| global::Sample.ClientUriBuilder uri = new global::Sample.ClientUriBuilder(); | ||
| uri.Reset(_endpoint); | ||
| uri.AppendQuery("oldParam", exact_param, true); | ||
| global::System.ClientModel.Primitives.PipelineMessage message = Pipeline.CreateMessage(uri.ToUri(), "GET", PipelineMessageClassifier200); | ||
| global::System.ClientModel.Primitives.PipelineRequest request = message.Request; | ||
| message.Apply(options); | ||
| return message; | ||
| } | ||
| } | ||
| } |
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
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
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
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
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
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
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
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
7 changes: 7 additions & 0 deletions
7
.../BuildEnumType_ExactValueNameTakesPrecedenceOverLastContract(Extensible)/MockInputEnum.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| namespace Sample.Models | ||
| { | ||
| public readonly partial struct MockInputEnum | ||
| { | ||
| public static MockInputEnum ApiKey { get; } | ||
| } | ||
| } |
7 changes: 7 additions & 0 deletions
7
...Tests/BuildEnumType_ExactValueNameTakesPrecedenceOverLastContract(Fixed)/MockInputEnum.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| namespace Sample.Models | ||
| { | ||
| public enum MockInputEnum | ||
| { | ||
| ApiKey | ||
| } | ||
| } |
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
24 changes: 24 additions & 0 deletions
24
...s/BackCompatibility_ExactPropertyNameTakesPrecedence(Last)/SampleNamespaceModelFactory.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| using SampleTypeSpec; | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Collections.ObjectModel; | ||
| using Sample.Models; | ||
|
|
||
| namespace Sample.Namespace | ||
| { | ||
| public static partial class SampleNamespaceModelFactory | ||
| { | ||
| public static PublicModel1 PublicModel1( | ||
| string oldStringProp = default, | ||
| Thing oldModelProp = default, | ||
| IEnumerable<string> listProp = default, | ||
| IDictionary<string, string> dictProp = default) | ||
| { return null; } | ||
| } | ||
| } | ||
|
|
||
| namespace Sample.Models | ||
| { | ||
| public partial class Thing | ||
| { } | ||
| } |
61 changes: 61 additions & 0 deletions
61
.../TestData/ModelFactoryProviderTests/BackCompatibility_ExactPropertyNameTakesPrecedence.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| // <auto-generated/> | ||
|
|
||
| #nullable disable | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using Sample.Models; | ||
|
|
||
| namespace Sample.Namespace | ||
| { | ||
| public static partial class SampleNamespaceModelFactory | ||
| { | ||
| public static global::Sample.Models.PublicModel1 PublicModel1(string stringProp = default, global::Sample.Models.Thing oldModelProp = default, global::System.Collections.Generic.IEnumerable<string> listProp = default, global::System.Collections.Generic.IDictionary<string, string> dictProp = default) | ||
| { | ||
| listProp ??= new global::Sample.Namespace.ChangeTrackingList<string>(); | ||
| dictProp ??= new global::Sample.Namespace.ChangeTrackingDictionary<string, string>(); | ||
|
|
||
| return new global::Sample.Models.PublicModel1(stringProp, oldModelProp, listProp.ToList(), dictProp, additionalBinaryDataProperties: null); | ||
| } | ||
|
|
||
| public static global::Sample.Models.PublicModel2 PublicModel2(string stringProp = default, global::Sample.Models.Thing modelProp = default, global::System.Collections.Generic.IEnumerable<string> listProp = default, global::System.Collections.Generic.IDictionary<string, string> dictProp = default) | ||
| { | ||
| listProp ??= new global::Sample.Namespace.ChangeTrackingList<string>(); | ||
| dictProp ??= new global::Sample.Namespace.ChangeTrackingDictionary<string, string>(); | ||
|
|
||
| return new global::Sample.Models.PublicModel2(stringProp, modelProp, listProp.ToList(), dictProp, additionalBinaryDataProperties: null); | ||
| } | ||
|
|
||
| public static global::Sample.Models.DerivedModel DerivedModel(string stringProp = default, global::Sample.Models.Thing modelProp = default, global::System.Collections.Generic.IEnumerable<string> listProp = default, global::System.Collections.Generic.IDictionary<string, string> dictProp = default) | ||
| { | ||
| listProp ??= new global::Sample.Namespace.ChangeTrackingList<string>(); | ||
| dictProp ??= new global::Sample.Namespace.ChangeTrackingDictionary<string, string>(); | ||
|
|
||
| return new global::Sample.Models.DerivedModel( | ||
| additionalBinaryDataProperties: null, | ||
| stringProp, | ||
| modelProp, | ||
| listProp.ToList(), | ||
| dictProp, | ||
| default); | ||
| } | ||
|
|
||
| public static global::Sample.Models.BaseModel BaseModel(string stringProp = default, global::Sample.Models.Thing modelProp = default, global::System.Collections.Generic.IEnumerable<string> listProp = default, global::System.Collections.Generic.IDictionary<string, string> dictProp = default) | ||
| { | ||
| listProp ??= new global::Sample.Namespace.ChangeTrackingList<string>(); | ||
| dictProp ??= new global::Sample.Namespace.ChangeTrackingDictionary<string, string>(); | ||
|
|
||
| return new global::Sample.Models.BaseModel(stringProp, modelProp, listProp.ToList(), dictProp, additionalBinaryDataProperties: null); | ||
| } | ||
|
|
||
| public static global::Sample.Models.ModelWithUnknownAdditionalProperties ModelWithUnknownAdditionalProperties(string stringProp = default, global::Sample.Models.Thing modelProp = default, global::System.Collections.Generic.IEnumerable<string> listProp = default, global::System.Collections.Generic.IDictionary<string, string> dictProp = default, global::System.Collections.Generic.IDictionary<string, global::System.BinaryData> additionalProperties = default) | ||
| { | ||
| listProp ??= new global::Sample.Namespace.ChangeTrackingList<string>(); | ||
| dictProp ??= new global::Sample.Namespace.ChangeTrackingDictionary<string, string>(); | ||
| additionalProperties ??= new global::Sample.Namespace.ChangeTrackingDictionary<string, global::System.BinaryData>(); | ||
|
|
||
| return new global::Sample.Models.ModelWithUnknownAdditionalProperties(stringProp, modelProp, listProp.ToList(), dictProp, additionalProperties); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.