Skip to content

Conversation

@tmelliottjr
Copy link

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 92.85714% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.47%. Comparing base (e1238d0) to head (f712cfb).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
github/projects.go 92.85% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3888      +/-   ##
==========================================
- Coverage   92.48%   92.47%   -0.01%     
==========================================
  Files         200      200              
  Lines       14564    14594      +30     
==========================================
+ Hits        13469    13496      +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
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.

2 participants