Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@tmelliottjr
Copy link
Contributor

This PR addresses a few gaps found between the current implementation and GitHub's ProjectsV2 OpenAPI spec:

  • Introduced new ProjectV2ItemContent and ProjectV2ItemWithContent structs, along with a custom UnmarshalJSON implementation to inspect the content_type returned by the API and automatically unmarshall the item's content (Issue|PullRequest|DraftIssue) into the correct struct.
  • Added accessor methods for ProjectV2, ProjectV2DraftIssue, ProjectV2ItemContent, ProjectV2ItemWithContent, and ProjectV2StatusUpdate structs.
  • Changed the ContentType field on ProjectV2Item from *string to a dedicated *ProjectV2ItemContentType type for improved type safety.
  • Added IsTemplate and LatestStatusUpdate to the existing ProjectV2 struct.

@tmelliottjr tmelliottjr marked this pull request as ready for review December 17, 2025 18:30
@codecov
Copy link

codecov bot commented Dec 17, 2025

Codecov Report

❌ Patch coverage is 90.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.53%. Comparing base (c98fd62) to head (fa35680).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
github/projects.go 90.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3888      +/-   ##
==========================================
- Coverage   92.54%   92.53%   -0.01%     
==========================================
  Files         200      200              
  Lines       14679    14709      +30     
==========================================
+ Hits        13584    13611      +27     
- Misses        895      897       +2     
- Partials      200      201       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Dec 18, 2025
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

I'm wondering if we need a brand new "...WithContent" type here?
Since this PR is breaking the API anyway, can't you just do all the unmarshaling into the original "ProjectV2Item" struct?

It seems odd to me to continue to have both a "ProjectV2Item" and a "ProjectV2ItemWithContent" (and the extra maintenance burden that causes) if we can avoid it.

Thoughts?

@gmlewis gmlewis added the Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). label Dec 18, 2025
@tmelliottjr
Copy link
Contributor Author

It seems odd to me to continue to have both a "ProjectV2Item" and a "ProjectV2ItemWithContent" (and the extra maintenance burden that causes) if we can avoid it.

@gmlewis I had actually considered that and talked myself out of it, somehow. I'll push up some updates to consolidate these.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

OK, I'm liking this much better... thank you, @tmelliottjr!
I would like to get some feedback from the developers who recently put in a good deal of work on ProjectV2 to make sure they are OK with these changes...
and then we will need a second LGTM+Approval from any other contributor to this repo before merging.

cc: @stephenotalora - @stevehipwell - @alexandear - @zyfy29

@gmlewis
Copy link
Collaborator

gmlewis commented Dec 18, 2025

@tmelliottjr - as for the code coverage, if you could please try to add tests that cover these two lines, that would be a nice little bonus. The first one should be trivial... the second one might be trickier... and if it is too much of a pain, don't worry about it. Thank you!

codecov-3888

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @tmelliottjr!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

Copy link
Contributor

@stephenotalora stephenotalora left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@gmlewis
Copy link
Collaborator

gmlewis commented Dec 19, 2025

Thank you, @stephenotalora!
Merging.

@tmelliottjr
Copy link
Contributor Author

@gmlewis I am working on at least one other PR that may involve breaking changes. There are some updates to an existing endpoint and the addition of a new one that I'd like to add support for. Those PRs are waiting for descriptions to be published, so they're not quite ready.

I'm curious what the release cadence looks like to better coordinate the changes?

@gmlewis
Copy link
Collaborator

gmlewis commented Dec 19, 2025

I'm curious what the release cadence looks like to better coordinate the changes?

We are a bit casual flexible about the release cadence in this repo.

Generally, we shoot for one release per month, but sometimes we exceed that and sometimes it takes longer.
The last release was 2 weeks ago, so we are probably shooting for another release in a couple weeks (early January 2026) but again, we can be flexible if some users of this repo have pressing deadlines and prefer "official" releases to simply pulling in SHA commit hashes for the features they need.

@gmlewis gmlewis merged commit e10040d into google:master Dec 19, 2025
6 of 8 checks passed
@tmelliottjr
Copy link
Contributor Author

Wonderful! Thanks for the info.

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

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). NeedsReview PR is awaiting a review before merging.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants