Skip to content

fix!: Fix field selection and bugs in ProjectsV2 GET endpoints - #3809

Merged
gmlewis merged 7 commits into
google:masterfrom
stephenotalora:stephenotalora/get-and-patch-project-item-fix
Nov 12, 2025
Merged

fix!: Fix field selection and bugs in ProjectsV2 GET endpoints#3809
gmlewis merged 7 commits into
google:masterfrom
stephenotalora:stephenotalora/get-and-patch-project-item-fix

Conversation

@stephenotalora

@stephenotalorastephenotalora commented Nov 6, 2025

Copy link
Copy Markdown
Contributor

BREAKING CHANGE: UpdateProjectItemOptions.Field is now []*ProjectV2FieldUpdate.

Discovered these issues while integrating the related project item APIs exposed in V77.

Fixes bugs in the implementation of support for field selection and updates in the following project item endpoints:

  • Properly handles URL parameters for field selection in GetOrganizationProjectItem and GetUserProjectItem.
  • Corrects field update struct and request payload formatting in UpdateOrganizationProjectItem and UpdateUserProjectItem.

Adds or updates tests to verify correct handling of these cases.

Covers:
https://docs.github.com/en/rest/projects/items?apiVersion=2022-11-28

Related REST API docs:

Complements: #3793

@stephenotalorastephenotalora changed the title Stephenotalora/get and patch project item fixfix: field selection and update bugs in project item GET/PATCH endpointsNov 6, 2025
@stephenotalora
stephenotalora marked this pull request as ready for review November 6, 2025 23:55
@codecov

codecovBot commented Nov 7, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.33%. Comparing base (1b4b8cc) to head (9f0e22e).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@## master #3809 +/- ##
=======================================
Coverage 92.32% 92.33% =======================================
Files 194 194 Lines 13984 13990 +6 =======================================
+ Hits 12911 12917 +6 
Misses 884 884 Partials 189 189 

☔ 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.

@gmlewisgmlewis changed the title fix: field selection and update bugs in project item GET/PATCH endpointsfix!: Fix field selection and bugs in ProjectsV2 GET endpointsNov 7, 2025
@gmlewisgmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). bug labels Nov 7, 2025

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @stephenotalora!
Please add testBadOptions to all your new unit tests to improve the code coverage.

@stephenotalora

Copy link
Copy Markdown
ContributorAuthor

Thank you, @stephenotalora! Please add testBadOptions to all your new unit tests to improve the code coverage.

Good catch, @gmlewis 🙇🏼 fixed! I was deep in the bug fixes and glossed over that. 👍

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

cc: @stevehipwell - @alexandear - @zyfy29

Comment threadgithub/projects.go Outdated
// It contains the field ID and the new value to set.
//
// GitHub API docs: https://docs.github.com/rest/projects/items#update-project-item-for-organization
type ProjectV2FieldUpdate struct {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why not?

Suggested change
typeProjectV2FieldUpdatestruct {
typeUpdateProjectV2Fieldstruct {

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

This has been fixed as part of 3bbb927

@stephenotalora

stephenotalora commented Nov 10, 2025

Copy link
Copy Markdown
ContributorAuthor

@alexandear@gmlewis I need to make an adjustment to the API payload for fields before moving this forward. We identified a discrepancy between the documented schema and the payload currently returned by the server. I’m converting this PR back to draft while I align the affected structs with the updated documentation. I should be able to reopen the PR tomorrow and will share the new commits once they're ready. I'll also address recent feedback, Thanks for your patience!

@stephenotalora
stephenotalora marked this pull request as draft November 10, 2025 04:19
@stephenotalora

stephenotalora commented Nov 10, 2025

Copy link
Copy Markdown
ContributorAuthor

@alexandear@gmlewis I need to make an adjustment to the API payload for fields before moving this forward. We identified a discrepancy between the documented schema and the payload currently returned by the server. I’m converting this PR back to draft while I align the affected structs with the updated documentation. I should be able to reopen the PR tomorrow and will share the new commits once they're ready. I'll also address recent feedback, Thanks for your patience!

@gmlewis I’ve resolved the discrepancy noted earlier in commit 3bbb927 and verified the changes against production data S2S using google/go-github pointing to my branch (via go.mod). The issue was caused by slightly inaccurate OpenAPI definitions on our end, which I’ve now corrected to reflect the expected payload shape. The primary change introduced in this commit (3bbb927) is the addition of a dedicated struct for text-based fields: ProjectV2TextContent which contains (raw + html) fields to accurately represent the server response for the corresponding Projects APIs.

For concrete examples, click to expand
APIGithub DocsServer Response
itemsScreenshot 2025-11-10 at 10 14 21 AMScreenshot 2025-11-10 at 10 17 54 AM
fieldsScreenshot 2025-11-10 at 10 20 46 AMScreenshot 2025-11-10 at 10 21 17 AMScreenshot 2025-11-10 at 10 22 02 AMScreenshot 2025-11-10 at 10 22 25 AM

Without the fix in 3bbb927, the request resulted in unmarshal errors due to mismatched object shapes.

@stephenotalora
stephenotalora marked this pull request as ready for review November 10, 2025 22:57
@gmlewis

Copy link
Copy Markdown
Collaborator

OK, so this is now ready for merging, correct, @stephenotalora?
@alexandear - are you OK for this PR to be merged?

@stephenotalora

Copy link
Copy Markdown
ContributorAuthor

OK, so this is now ready for merging, correct, @stephenotalora?

Yes, correct, ready to go, tested quite extensively S2S today 👍🏼

@alexandear

Copy link
Copy Markdown
Contributor

I'm OK.

@gmlewis

Copy link
Copy Markdown
Collaborator

Thank you, @stephenotalora and @alexandear!
Merging.

@gmlewisgmlewis removed the NeedsReview PR is awaiting a review before merging. label Nov 12, 2025
@gmlewis
gmlewis merged commit 8657c38 into google:masterNov 12, 2025
7 checks passed
@stephenotalora

Copy link
Copy Markdown
ContributorAuthor

Thank you, @stephenotalora and @alexandear! Merging.

Thanks so much for getting this merged, @gmlewis! 🙏🏼 Do you happen to know when the next release might be planned? I’d love to start using the latest changes downstream. Thanks again 🙇🏼

@gmlewis

Copy link
Copy Markdown
Collaborator

Thanks so much for getting this merged, @gmlewis! 🙏🏼 Do you happen to know when the next release might be planned? I’d love to start using the latest changes downstream. Thanks again 🙇🏼

We just made two quick releases in a row based on requests, but we could probably do another release after #3814 gets merged.

@gmlewis

Copy link
Copy Markdown
Collaborator

This is now available here:
https://github.com/google/go-github/releases/tag/v79.0.0

jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
…e#3809)
BREAKING CHANGE: `UpdateProjectItemOptions.Field` is now `[]*ProjectV2FieldUpdate`.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API ChangePR will require a bump to the major version num in next release. Look here to see the change(s).bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@stephenotalora@gmlewis@alexandear