octokit / dotnet-sdk

MIT License
57 stars 8 forks source link

First impressions #4

Open martincostello opened 11 months ago

martincostello commented 11 months ago

Hey folks,

I just took a quick look at pulling this into an existing application of mine and I thought I'd just give you some initial feedback. I didn't get very far as it was hundreds of compiler warnings, so just tweaked a small part of it to get a feel for things.

I realise it's very early and some of it might be things you already know about, so no worries if I'm not telling you anything new.

Also this is intended to be neutral feedback on first impressions, don't take it as positive or negative, just "huh, that's different" observations.

Here's an example of some of the above in a single snippet of code using the generated API instead of Octokit.net:

using GitHub.Octokit;

// Really really long and repetitive namespace
using GitHub.Octokit.Repos.Item.Item.Pulls.Item.Reviews;

OctokitClient client = CreateClient(...);

var review = new ReviewsPostRequestBody()
{
    Event = ReviewsPostRequestBody_event.APPROVE, // Underscore and all caps type and member name
};

// Lots of indexers
await client.Repos[owner][name].Pulls[number].Reviews.PostAsync(review);

The Octokit equivalent of the above was:

using Octokit;

IGitHubClient client = CreateClient(...);

var review = new PullRequestReviewCreate()
{
    Event = PullRequestReviewEvent.Approve
};

await client.PullRequest.Review.Create(owner, name, number, review);

I hope the observations are useful.

nickfloyd commented 11 months ago

Hey @martincostello thank you so much for the feedback and perspective here! We were hoping for information like this. @kfcampbell and I are going to have a look at what you posted and chat about it to see what we can apply and change. Please keep this perspective coming if you have the time. The whole octokit community will be loads better because of it! ❤

nickfloyd commented 11 months ago

Hey @martincostello,

We've been looking into your thoughts and comments. Thanks again. Just a quick update.

not building. We had some ignore patterns that were colliding with our generated endpoints and models - those should be fixed now.

Naming This is something we'll be tweaking - we went with some plausible defaults for generation - we're definitley going to drive to using PascalCase for publics, camel for private members, and so on. We'll also be implementing linting as a CI gate to prevent deviation.

Namespacing Too right. That has to do with the way things nest, object hierarchy, and the tree walking that has to be done to generate things. Hopefully we can simplify this as we discover more... super good call out though.

dictionaries/indexers We're still looking into this.

indexer parameters are all called position 100%, hopefully we can come up with some formatters that will get this more "right" - wed definitely like to favor expressiveness - especially when it comes to the basics like this!

RepositoryVisbility Missing enums. Yikes, we're still hunting this one down as well. Thanks for the head's up.

martincostello commented 11 months ago

Thanks for taking a look.

Let me know when you've either pushed something to NuGet or pushed a bunch of changes worth re-review and I can take another look at it in one of the repos I use Octokit in.

martincostello commented 10 months ago

Hey folks - I've taken another look at things using the Octokit.NET.SDK NuGet package, and had another go at migrating one of my apps over to use it. Here's some additional observations from the partial changes I made in this commit.

HavenDV commented 2 months ago

It's interesting to watch this repository I do roughly the same thing, only for a series of different AI related SDKs within the tryAGI organization for the LangChain.NET project: https://github.com/tryAGI/OpenAI https://github.com/tryAGI/Anthropic https://github.com/tryAGI/AutoSDK The repository itself contains 10+ other SDKs that are also automatically supported We also use CodeRabbit to review/summarize changes and automatically generate titles/descriptions for PRs, so that we can use this when generating release notes

I also tried to do this based on the GitHub OpenAPI specification, but dotnet cli can't build it within the standard free worker on CICD: https://github.com/HavenDV/GitHub.NET Since the code does not contain dependencies, there is more of it and this can create these difficulties during the build, but it would also be interesting to know if have you had such problems