Skip to content

Conversation

@stephenotalora
Copy link
Contributor

@stephenotalora stephenotalora commented Nov 6, 2025

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

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

codecov bot commented Nov 7, 2025

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.

@gmlewis gmlewis changed the title fix: field selection and update bugs in project item GET/PATCH endpoints fix!: Fix field selection and bugs in ProjectsV2 GET endpoints Nov 7, 2025
@gmlewis gmlewis 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
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, @stephenotalora!
Please add testBadOptions to all your new unit tests to improve the code coverage.

@stephenotalora
Copy link
Contributor Author

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

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, @stephenotalora!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear - @zyfy29

// 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
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
type ProjectV2FieldUpdate struct {
type UpdateProjectV2Field struct {

Copy link
Contributor Author

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
Copy link
Contributor Author

stephenotalora commented Nov 10, 2025

@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
Copy link
Contributor Author

stephenotalora commented Nov 10, 2025

@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
API Github Docs Server Response
items Screenshot 2025-11-10 at 10 14 21 AM Screenshot 2025-11-10 at 10 17 54 AM
fields Screenshot 2025-11-10 at 10 20 46 AM Screenshot 2025-11-10 at 10 21 17 AM Screenshot 2025-11-10 at 10 22 02 AM Screenshot 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
Collaborator

gmlewis commented Nov 10, 2025

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

@stephenotalora
Copy link
Contributor Author

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

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

@alexandear
Copy link
Contributor

I'm OK.

@gmlewis
Copy link
Collaborator

gmlewis commented Nov 12, 2025

Thank you, @stephenotalora and @alexandear!
Merging.

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

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
Collaborator

gmlewis commented Nov 12, 2025

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.

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). bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants