Skip to content
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

Repository WatchersCount actually refers to Starred #2509

Closed
JonruAlveus opened this issue Jul 23, 2022 · 4 comments · Fixed by #2519
Closed

Repository WatchersCount actually refers to Starred #2509

JonruAlveus opened this issue Jul 23, 2022 · 4 comments · Fixed by #2519
Labels
Status: Needs info Full requirements are not yet known, so implementation should not be started Status: Up for grabs Issues that are ready to be worked on by anyone

Comments

@JonruAlveus
Copy link
Collaborator

JonruAlveus commented Jul 23, 2022

The response for getting a repository contains a watchers_count property. This doesn't actually refer to watchers, but to Stars (unless stars add watchers?). I've created a repository, added a watch via the Activity.Watch client and the property is 0 when retrieved. If I start it, the property becomes 1.

I wonder if there is something wrong in the background as watchers_count seems to follow stargazers.

This shows what I mean, it's watched by 1 and starred by 0, but watchers_count and stargazers are both 0.
image

@nickfloyd
Copy link
Contributor

Interesting, good catch! I wonder if there is a transposed element in the OpenAPI descriptions - given how we dynamically hydrate the response object this is most likely on the GitHub REST API side of things.

I'll put it on the list of things to look into unless anyone else has time to grok the OpenAPI descriptions.

@JonruAlveus
Copy link
Collaborator Author

I'm not sure what the openapi spec is telling us, but here's the bit we're talking about

image

They both have the same example value, not sure if that's relevant?

@Brend-Smits
Copy link
Contributor

Brend-Smits commented Aug 2, 2022

This seems like a bug in the GitHub API itself. I just tested it by using the GitHub CLI and Postman and get the same bug as you reported.
I don't think we can fix this in this repository, needs to be escalated to the GH Team.

Seems like GitHub is no longer using the watchers_count and you should instead use the subscribers_count. Quite misleading if you ask me... Related discussion: https://github.com/orgs/community/discussions/24795

Brend-Smits added a commit to Brend-Smits/octokit.net that referenced this issue Aug 2, 2022
Subscribers_count shows the actual watchers_count. Many people think they are retrieving the watchers_count, but are actually retrieving the stargazers_count...
This is because the GitHub UI is still calling subscribers, "Watchers".
To prevent many others from falling into this trap, a warning should be added to the watchers_count property.

On top of this, subscribers_count is no longer deprecated as far as the GitHub documentation goes.

Fixes octokit#2509

Signed-off-by: Brend Smits <[email protected]>
@nickfloyd
Copy link
Contributor

@Brend-Smits Thanks for tracking this down! It's not an ideal situation. Hopefully, in the future, with versioning - this type of thing will be a non-issue as in, fields will be more easily deprecated.

nickfloyd pushed a commit that referenced this issue Aug 2, 2022
…unt. (#2519)

Subscribers_count shows the actual watchers_count. Many people think they are retrieving the watchers_count, but are actually retrieving the stargazers_count...
This is because the GitHub UI is still calling subscribers, "Watchers".
To prevent many others from falling into this trap, a warning should be added to the watchers_count property.

On top of this, subscribers_count is no longer deprecated as far as the GitHub documentation goes.

Fixes #2509

Signed-off-by: Brend Smits <[email protected]>
@nickfloyd nickfloyd added Status: Needs info Full requirements are not yet known, so implementation should not be started Status: Up for grabs Issues that are ready to be worked on by anyone and removed needs-more-information labels Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs info Full requirements are not yet known, so implementation should not be started Status: Up for grabs Issues that are ready to be worked on by anyone
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants