Skip to content

[Approved] Add repository topics#2246

Merged
shiftkey merged 56 commits intooctokit:mainfrom
SeanKilleen:1707_add-repository-topics
Feb 25, 2021
Merged

[Approved] Add repository topics#2246
shiftkey merged 56 commits intooctokit:mainfrom
SeanKilleen:1707_add-repository-topics

Conversation

@SeanKilleen
Copy link
Contributor

@SeanKilleen SeanKilleen commented Sep 8, 2020

Resolves #1707.
Supersedes #1721

Will use #1721 as a reference but doing the steps myself to gain better experience/understanding of the codebase.

Comments and suggestions welcome along the way!

Work Remaining

Response Class Support

  • Add Topics field to Repository response class
  • Specify new preview header on all calls that return Repository responses

New API Calls

  • List all Topics
  • Replace all Topics

Support Search Repositories by Topic
https://help.github.com/articles/searching-repositories/#search-by-repository-topic

  • Add string Topic field to SearchRepositoriesRequest and format search parameters accordingly
  • Add Range Topics field to SearchRepositoriesRequest and format search parameters accordingly

Tests

  • Integration Tests for GetAllTopics
  • Integreation Tests for ReplaceAllTopics
  • Integration Tests for Searches
  • Unit tests for ReplaceAllTopics
  • Unit tests for GetAllTopics
  • Unit tests for search
  • Unit tests for RepositoryTopics
  • Clean up integration tests -- remove double-checks?
  • Clean up integration tests -- remove IDisposable in favor of another technique?

Other stuff discovered as I progressed

  • Need to make sure the mercy preview is enforced -- the PreviewAttribute is metadata, which I'd misunderstood.
  • Add overloads for repositories by ID.
  • Update the IRepositoriesClient interface
  • Add ApiOptions Overloads
  • Update observable client as well

@codecov
Copy link

codecov bot commented Sep 8, 2020

Codecov Report

Merging #2246 (2bc3df5) into main (2e5fb68) will increase coverage by 0.07%.
The diff coverage is 78.43%.

@@            Coverage Diff             @@
##             main    #2246      +/-   ##
==========================================
+ Coverage   65.92%   65.99%   +0.07%     
==========================================
  Files         553      554       +1     
  Lines       14469    14519      +50     
  Branches      846      857      +11     
==========================================
+ Hits         9538     9582      +44     
- Misses       4773     4779       +6     
  Partials      158      158              
Impacted Files Coverage Δ
...t.Reactive/Clients/ObservableRepositoriesClient.cs 65.83% <0.00%> (-2.55%) ⬇️
Octokit/Clients/RepositoryForksClient.cs 100.00% <ø> (ø)
Octokit/Helpers/AcceptHeaders.cs 100.00% <ø> (ø)
Octokit/Models/Response/Repository.cs 5.31% <0.00%> (-0.12%) ⬇️
Octokit/Models/Response/RepositoryTopics.cs 75.00% <75.00%> (ø)
Octokit/Clients/RepositoriesClient.cs 95.67% <100.00%> (+0.61%) ⬆️
Octokit/Helpers/ApiUrls.cs 97.53% <100.00%> (+0.01%) ⬆️
...ctokit/Models/Request/SearchRepositoriesRequest.cs 76.99% <100.00%> (+5.02%) ⬆️

@SeanKilleen SeanKilleen marked this pull request as ready for review September 8, 2020 13:54
@SeanKilleen SeanKilleen changed the title WIP: Add repository topics [WIP]: Add repository topics Sep 8, 2020
@SeanKilleen
Copy link
Contributor Author

Converting this from a draft PR as I'd love feedback on the progress so far and some discussion around the items I raise.

(I know it needs tests; suggestions on the best places to focus my efforts there are also welcome.)

@SeanKilleen
Copy link
Contributor Author

SeanKilleen commented Sep 8, 2020

Pinging @ryangribble @shiftkey for a quick pass on this when you get the chance (I think you're who I should ping for this sort of thing; if not, please feel free to tag others in. And sorry if the pinging is unwelcome! I couldn't find guidance on that.)

I'll continue plodding forward, but I've left some review comments with questions / potential concerns, and I'd love feedback on where to focus the tests though I'll work to suss that out in the meantime.

@SeanKilleen
Copy link
Contributor Author

I see after making some updates that I need to ensure I can accept ApiOptions and also that I need to update the observable client.

(I absolutely love these kinds of tests that help provide guardrails for someone like me cotributing changes -- thank you!!)

@ErikSchierboom
Copy link
Contributor

This would be great to have!

@FraserGreenroyd
Copy link

Keen to see this support added if it's possible 😄 subscribing for updates!

@SeanKilleen
Copy link
Contributor Author

Hey all -- bumping this to put it back on the radar. If the PR is too big or is taking too much mental effort to review, I can totally understand that and I'd be happy to restructure to break things up in a better way if possible.

Any feedback appreciated. 👍 And if it's just that you remain swamped / a little burned out, that's fine and completely understandable as well.

Copy link
Contributor

@haacked haacked left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

{
readonly IGitHubClient _github = Helper.GetAuthenticatedClient();
readonly RepositoryTopics _defaultTopics = new RepositoryTopics(new List<string> { "blog", "ruby", "jekyll" });
const string theRepoOwner = "SeanKilleen";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My memory is a bit hazy, but I think there are test helpers for creating a repository. That way an integration can create a repository, do the test stuff, then delete the repository at the end.

Copy link
Member

@shiftkey shiftkey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your persistence on this @SeanKilleen, and apologies for the delay in getting to this.

Only suggestions I have are about the integration test setup, everything else looks good to me.

@SeanKilleen
Copy link
Contributor Author

@shiftkey no worries! Thanks for reviewing. Comments make sense to me and I appreciate you pointing me in the right spot for the helper code. Integration tests will be fixed up ASAP.

@SeanKilleen
Copy link
Contributor Author

@shiftkey I've made the changes to add and use the context -- thank you!

Looks like there is a conflict with the method signature for the repository constructor. Going to fix it up now and hopefully we'll be good to go shortly.

@SeanKilleen SeanKilleen changed the title [Ready for Review] Add repository topics [Approved] Add repository topics Feb 22, 2021
@SeanKilleen
Copy link
Contributor Author

@shiftkey OK, I think this is ready from my end once the build passes.

@SeanKilleen
Copy link
Contributor Author

@shiftkey no rush, but following up to say the build has passed so after a cursory review, I think this should be ready to go. Thanks for your follow-up!

@shiftkey shiftkey merged commit 57fe2ce into octokit:main Feb 25, 2021
@shiftkey
Copy link
Member

release_notes: Add support for repository topics API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Repository Topics

7 participants