-
Notifications
You must be signed in to change notification settings - Fork 333
Fix property lookup to support inheritance in pagination response models #9419
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
55 changes: 55 additions & 0 deletions
55
...t/Providers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBody.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,55 @@ | ||
| // <auto-generated/> | ||
|
|
||
| #nullable disable | ||
|
|
||
| using System; | ||
| using System.ClientModel; | ||
| using System.ClientModel.Primitives; | ||
| using System.Collections.Generic; | ||
| using Sample.Models; | ||
|
|
||
| namespace Sample | ||
| { | ||
| internal partial class CatClientGetCatsCollectionResult : global::System.ClientModel.Primitives.CollectionResult | ||
| { | ||
| private readonly global::Sample.CatClient _client; | ||
| private readonly global::System.ClientModel.Primitives.RequestOptions _options; | ||
|
|
||
| public CatClientGetCatsCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) | ||
| { | ||
| _client = client; | ||
| _options = options; | ||
| } | ||
|
|
||
| public override global::System.Collections.Generic.IEnumerable<global::System.ClientModel.ClientResult> GetRawPages() | ||
| { | ||
| global::System.ClientModel.Primitives.PipelineMessage message = _client.CreateGetCatsRequest(_options); | ||
| global::System.Uri nextPageUri = null; | ||
| while (true) | ||
| { | ||
| global::System.ClientModel.ClientResult result = global::System.ClientModel.ClientResult.FromResponse(_client.Pipeline.ProcessMessage(message, _options)); | ||
| yield return result; | ||
|
|
||
| nextPageUri = ((global::Sample.Models.Page)result).NextCat; | ||
| if ((nextPageUri == null)) | ||
| { | ||
| yield break; | ||
| } | ||
| message = _client.CreateNextGetCatsRequest(nextPageUri, _options); | ||
| } | ||
| } | ||
|
|
||
| public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) | ||
| { | ||
| global::System.Uri nextPage = ((global::Sample.Models.Page)page).NextCat; | ||
| if ((nextPage != null)) | ||
| { | ||
| return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.AbsoluteUri)); | ||
| } | ||
| else | ||
| { | ||
| return null; | ||
| } | ||
| } | ||
| } | ||
| } |
55 changes: 55 additions & 0 deletions
55
...viders/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyAsync.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,55 @@ | ||
| // <auto-generated/> | ||
|
|
||
| #nullable disable | ||
|
|
||
| using System; | ||
| using System.ClientModel; | ||
| using System.ClientModel.Primitives; | ||
| using System.Collections.Generic; | ||
| using Sample.Models; | ||
|
|
||
| namespace Sample | ||
| { | ||
| internal partial class CatClientGetCatsAsyncCollectionResult : global::System.ClientModel.Primitives.AsyncCollectionResult | ||
| { | ||
| private readonly global::Sample.CatClient _client; | ||
| private readonly global::System.ClientModel.Primitives.RequestOptions _options; | ||
|
|
||
| public CatClientGetCatsAsyncCollectionResult(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) | ||
| { | ||
| _client = client; | ||
| _options = options; | ||
| } | ||
|
|
||
| public override async global::System.Collections.Generic.IAsyncEnumerable<global::System.ClientModel.ClientResult> GetRawPagesAsync() | ||
| { | ||
| global::System.ClientModel.Primitives.PipelineMessage message = _client.CreateGetCatsRequest(_options); | ||
| global::System.Uri nextPageUri = null; | ||
| while (true) | ||
| { | ||
| global::System.ClientModel.ClientResult result = global::System.ClientModel.ClientResult.FromResponse(await _client.Pipeline.ProcessMessageAsync(message, _options).ConfigureAwait(false)); | ||
| yield return result; | ||
|
|
||
| nextPageUri = ((global::Sample.Models.Page)result).NextCat; | ||
| if ((nextPageUri == null)) | ||
| { | ||
| yield break; | ||
| } | ||
| message = _client.CreateNextGetCatsRequest(nextPageUri, _options); | ||
| } | ||
| } | ||
|
|
||
| public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) | ||
| { | ||
| global::System.Uri nextPage = ((global::Sample.Models.Page)page).NextCat; | ||
| if ((nextPage != null)) | ||
| { | ||
| return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.AbsoluteUri)); | ||
| } | ||
| else | ||
| { | ||
| return null; | ||
| } | ||
| } | ||
| } | ||
| } |
60 changes: 60 additions & 0 deletions
60
...roviders/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyOfT.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,60 @@ | ||
| // <auto-generated/> | ||
|
|
||
| #nullable disable | ||
|
|
||
| using System; | ||
| using System.ClientModel; | ||
| using System.ClientModel.Primitives; | ||
| using System.Collections.Generic; | ||
| using Sample.Models; | ||
|
|
||
| namespace Sample | ||
| { | ||
| internal partial class CatClientGetCatsCollectionResultOfT : global::System.ClientModel.CollectionResult<global::Sample.Models.Cat> | ||
| { | ||
| private readonly global::Sample.CatClient _client; | ||
| private readonly global::System.ClientModel.Primitives.RequestOptions _options; | ||
|
|
||
| public CatClientGetCatsCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) | ||
| { | ||
| _client = client; | ||
| _options = options; | ||
| } | ||
|
|
||
| public override global::System.Collections.Generic.IEnumerable<global::System.ClientModel.ClientResult> GetRawPages() | ||
| { | ||
| global::System.ClientModel.Primitives.PipelineMessage message = _client.CreateGetCatsRequest(_options); | ||
| global::System.Uri nextPageUri = null; | ||
| while (true) | ||
| { | ||
| global::System.ClientModel.ClientResult result = global::System.ClientModel.ClientResult.FromResponse(_client.Pipeline.ProcessMessage(message, _options)); | ||
| yield return result; | ||
|
|
||
| nextPageUri = ((global::Sample.Models.Page)result).NextCat; | ||
| if ((nextPageUri == null)) | ||
| { | ||
| yield break; | ||
| } | ||
| message = _client.CreateNextGetCatsRequest(nextPageUri, _options); | ||
| } | ||
| } | ||
|
|
||
| public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) | ||
| { | ||
| global::System.Uri nextPage = ((global::Sample.Models.Page)page).NextCat; | ||
| if ((nextPage != null)) | ||
| { | ||
| return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.AbsoluteUri)); | ||
| } | ||
| else | ||
| { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| protected override global::System.Collections.Generic.IEnumerable<global::Sample.Models.Cat> GetValuesFromPage(global::System.ClientModel.ClientResult page) | ||
| { | ||
| return ((global::Sample.Models.Page)page).Cats; | ||
| } | ||
| } | ||
| } |
65 changes: 65 additions & 0 deletions
65
...ers/CollectionResultDefinitions/TestData/NextLinkTests/InheritedNextLinkInBodyOfTAsync.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,65 @@ | ||
| // <auto-generated/> | ||
|
|
||
| #nullable disable | ||
|
|
||
| using System; | ||
| using System.ClientModel; | ||
| using System.ClientModel.Primitives; | ||
| using System.Collections.Generic; | ||
| using System.Threading.Tasks; | ||
| using Sample.Models; | ||
|
|
||
| namespace Sample | ||
| { | ||
| internal partial class CatClientGetCatsAsyncCollectionResultOfT : global::System.ClientModel.AsyncCollectionResult<global::Sample.Models.Cat> | ||
| { | ||
| private readonly global::Sample.CatClient _client; | ||
| private readonly global::System.ClientModel.Primitives.RequestOptions _options; | ||
|
|
||
| public CatClientGetCatsAsyncCollectionResultOfT(global::Sample.CatClient client, global::System.ClientModel.Primitives.RequestOptions options) | ||
| { | ||
| _client = client; | ||
| _options = options; | ||
| } | ||
|
|
||
| public override async global::System.Collections.Generic.IAsyncEnumerable<global::System.ClientModel.ClientResult> GetRawPagesAsync() | ||
| { | ||
| global::System.ClientModel.Primitives.PipelineMessage message = _client.CreateGetCatsRequest(_options); | ||
| global::System.Uri nextPageUri = null; | ||
| while (true) | ||
| { | ||
| global::System.ClientModel.ClientResult result = global::System.ClientModel.ClientResult.FromResponse(await _client.Pipeline.ProcessMessageAsync(message, _options).ConfigureAwait(false)); | ||
| yield return result; | ||
|
|
||
| nextPageUri = ((global::Sample.Models.Page)result).NextCat; | ||
| if ((nextPageUri == null)) | ||
| { | ||
| yield break; | ||
| } | ||
| message = _client.CreateNextGetCatsRequest(nextPageUri, _options); | ||
| } | ||
| } | ||
|
|
||
| public override global::System.ClientModel.ContinuationToken GetContinuationToken(global::System.ClientModel.ClientResult page) | ||
| { | ||
| global::System.Uri nextPage = ((global::Sample.Models.Page)page).NextCat; | ||
| if ((nextPage != null)) | ||
| { | ||
| return global::System.ClientModel.ContinuationToken.FromBytes(global::System.BinaryData.FromString(nextPage.AbsoluteUri)); | ||
| } | ||
| else | ||
| { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| protected override async global::System.Collections.Generic.IAsyncEnumerable<global::Sample.Models.Cat> GetValuesFromPageAsync(global::System.ClientModel.ClientResult page) | ||
| { | ||
| foreach (global::Sample.Models.Cat item in ((global::Sample.Models.Page)page).Cats) | ||
| { | ||
| yield return item; | ||
| await global::System.Threading.Tasks.Task.Yield(); | ||
| } | ||
| } | ||
| } | ||
| } |
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.