-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add AsyncPaginationExtensions #2516
Add AsyncPaginationExtensions #2516
Conversation
Thank you for putting in the effort and time on this - it's looking great! ❤️ Regarding your questions and concerns:
Given that we are headed down to a more generative SDK I feel like... (see the discussions here and here and here for more info on that) IMO the preferred approach would be to have a generators project with things like your script above namespaced i.e. This way we're establishing the future location for all generators now to remove this question later. Also, this will allow us to use CI to build the generators, generate the code, and commit it before the other aspects of the SDK are built. As a side note, in my perfect world brain, all models and related libs would be hoisted out of this SDK and referenced in as a package so that we could better support versioning and be able to ship SDK core changes separate from SDK model changes. For now, let's create a generators project, add the script above, then document how to run and what to expect - we can do a follow-up for CI to implement this in a more automated way. Let me know what your thoughts.
This seems reasonable - in the future, we'll be looking at using Roslyn's source generation and templates as a more future-proof way to generate code from things like the OpenAPI descriptions, etc... the work you've done here just gets us all closer to that future! 💥
✅
The .csproj file looks fine to me... we haven't made the jump to .NET Standard 2.0 just yet - I'm working on that this week but I don't think that would cause the problems that you've described - do you have the error output from the compiler? If so post it and I'll have a look.
❤️ Yeah I love this. It isolates the paging concerns and it keeps things tidy (with generation and with other classes) 👍
Yeah, I agree it's nuanced and shouldn't be overblown. I feel like the tests you have are adequate. We might want tests around the generator itself just to assert it is doing what you expect it to do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some comments about the generator being in an actual project and adding some docs on usage. Let me know your thoughts on that. Thanks again for all of the excellent work here! ❤️
Also, I'd be glad to make those changes if you just want to get the ones you've already done in this PR merged in. Let me know your thoughts!
Hey, thanks for the extensive review! I'm currently in the middle of my exams, so I likely won't be able to get back to this for a few weeks, sorry for the inconvenience! I would definitely be up to implement the changes in question once I have the time to do so, but if you're able to scrape the time together to do them yourself in that time I would not object! :) |
@Saalvage sounds good... I'll move to merge this in and then do a fast follow on the generator project. Thank you for all of the work you've put in here... I wish you all the best on your exams too! I'm sure you'll do amazing! 🏫 🎓 |
As a follow up: #2534 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for getting the ball rolling here! I'll do a follow-up that will implement the generators and eventually some CI / build automation.
release_notes: Added an asynchronous paging extension that adds paging for all list-based response objects |
Compared to my original design draft I've decided to opt for a slightly more complex approach involving a class dedicated to providing both sequential as well as random access. It caches everything to make multiple enumerations (that possibly all don't iterate to the very end, saving resources) faster. Ultimately the cost to this should be minimal, as cacheless sequential access likely allocates the same amount of memory, just freeing it immediately afterwards.
I've written a script to generate the Extensions.cs file as it is basically just a bunch of boilerplate.
Here it is in its entirety:
I'm not sure whether it might be preferable to use CI to generate the Extensions.cs file to prevent it from becoming out of sync with the main project. And if not that whether this generator code should at least find a more permanent place somewhere in the repo (if so, where?)
A few additional points of concern:
Microsoft.Bcl.AsyncInterfaces
package being required. Especially since octokit itself is moving onto a more modern version this choice should potentially be revisited.<LangVersion>9</LangVersion>
as this allows for some cleaner as well as less restrictive code in a lot of places. I'm not sure whether this is actually relevant to library consumers at all.Reference Include
tags were causing errors which is why I removed them. I'd appreciate the .csproj file being taken a closer look at.If there's anything I can do to help with this being integrated please let me know! :)
Closes #2463