-
Notifications
You must be signed in to change notification settings - Fork 388
Guard optional path parameters before formatting #11760
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
Open
Copilot
wants to merge
12
commits into
main
Choose a base branch
from
copilot/address-missing-nullable-value-guard
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.
Open
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5940399
Initial plan
Copilot ceee147
fix(http-client-csharp): guard nullable date path formatting
Copilot e919a5c
fix(http-client-csharp): exclude enums from nullable value unwrap, us…
Copilot bd2a68c
fix(http-client-csharp): remove redundant guard unwrap and fix enum d…
Copilot 3068324
fix(http-client-csharp): guard nullable required path params, remove …
Copilot 4795fb4
test(http-client-csharp): cover nullable path guard branches
Copilot df2e7a3
Merge branch 'main' into copilot/address-missing-nullable-value-guard
jorgerangel-msft baead84
fix(http-client-csharp): guard and defer separator for required-nulla…
Copilot e8ad7b0
fix(http-client-csharp): use resolved path parameter's input name for…
Copilot c4c78a9
fix(http-client-csharp): keep path separator for required nullable en…
Copilot 91c227b
chore(http-client-csharp): remove stale inline comments in path guard…
Copilot be4eef7
fix(http-client-csharp): only guard optional path parameters and null…
jorgerangel-msft 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
Some comments aren't visible on the classic Files Changed page.
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
32 changes: 32 additions & 0 deletions
32
...Data/RestClientProviderTests/NullableDatePathParameterIsGuardedBeforeFormatting(False).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,32 @@ | ||
| // <auto-generated/> | ||
|
|
||
| #nullable disable | ||
|
|
||
| using System; | ||
| using System.ClientModel.Primitives; | ||
|
|
||
| namespace Sample | ||
| { | ||
| public partial class TestClient | ||
| { | ||
| private static global::System.ClientModel.Primitives.PipelineMessageClassifier _pipelineMessageClassifier200; | ||
|
|
||
| private static global::System.ClientModel.Primitives.PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= global::System.ClientModel.Primitives.PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); | ||
|
|
||
| internal global::System.ClientModel.Primitives.PipelineMessage CreateGetThingRequest(global::System.DateTimeOffset? requestOn, global::System.ClientModel.Primitives.RequestOptions options) | ||
| { | ||
| global::Sample.ClientUriBuilder uri = new global::Sample.ClientUriBuilder(); | ||
| uri.Reset(_endpoint); | ||
| uri.AppendPath("/things", false); | ||
| if ((requestOn != null)) | ||
| { | ||
| uri.AppendPath("/", false); | ||
| uri.AppendPath(requestOn?.ToString("R"), true); | ||
|
jorgerangel-msft marked this conversation as resolved.
Outdated
|
||
| } | ||
| 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; | ||
| } | ||
| } | ||
| } | ||
28 changes: 28 additions & 0 deletions
28
...tData/RestClientProviderTests/NullableDatePathParameterIsGuardedBeforeFormatting(True).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,28 @@ | ||
| // <auto-generated/> | ||
|
|
||
| #nullable disable | ||
|
|
||
| using System; | ||
| using System.ClientModel.Primitives; | ||
|
|
||
| namespace Sample | ||
| { | ||
| public partial class TestClient | ||
| { | ||
| private static global::System.ClientModel.Primitives.PipelineMessageClassifier _pipelineMessageClassifier200; | ||
|
|
||
| private static global::System.ClientModel.Primitives.PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= global::System.ClientModel.Primitives.PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); | ||
|
|
||
| internal global::System.ClientModel.Primitives.PipelineMessage CreateGetThingRequest(global::System.DateTimeOffset requestOn, global::System.ClientModel.Primitives.RequestOptions options) | ||
| { | ||
| global::Sample.ClientUriBuilder uri = new global::Sample.ClientUriBuilder(); | ||
| uri.Reset(_endpoint); | ||
| uri.AppendPath("/things/", false); | ||
| uri.AppendPath(requestOn.ToString("R"), 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; | ||
| } | ||
| } | ||
| } |
27 changes: 27 additions & 0 deletions
27
...ientProviders/TestData/RestClientProviderTests/OptionalEnumPathParameterIsNotUnwrapped.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,27 @@ | ||
| // <auto-generated/> | ||
|
|
||
| #nullable disable | ||
|
|
||
| using System.ClientModel.Primitives; | ||
|
|
||
| namespace Sample | ||
| { | ||
| public partial class TestClient | ||
| { | ||
| private static global::System.ClientModel.Primitives.PipelineMessageClassifier _pipelineMessageClassifier200; | ||
|
|
||
| private static global::System.ClientModel.Primitives.PipelineMessageClassifier PipelineMessageClassifier200 => _pipelineMessageClassifier200 ??= global::System.ClientModel.Primitives.PipelineMessageClassifier.Create(stackalloc ushort[] { 200 }); | ||
|
|
||
| internal global::System.ClientModel.Primitives.PipelineMessage CreateGetThingRequest(global::System.ClientModel.Primitives.RequestOptions options) | ||
| { | ||
| global::Sample.ClientUriBuilder uri = new global::Sample.ClientUriBuilder(); | ||
| uri.Reset(_endpoint); | ||
| uri.AppendPath("/things", false); | ||
| uri.AppendPath(_color?.ToString().ToString(), true); | ||
|
jorgerangel-msft marked this conversation as resolved.
Outdated
|
||
| 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; | ||
| } | ||
| } | ||
| } | ||
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.