fix!: Correct HostedRunner image struct fields and JSON tags to match API#4104
Open
austenstone wants to merge 3 commits intogoogle:masterfrom
Open
fix!: Correct HostedRunner image struct fields and JSON tags to match API#4104austenstone wants to merge 3 commits intogoogle:masterfrom
HostedRunner image struct fields and JSON tags to match API#4104austenstone wants to merge 3 commits intogoogle:masterfrom
Conversation
… API Fix incorrect JSON field names on HostedRunner and HostedRunnerImageDetail structs that don't match the GitHub API response, and rename the Go struct fields to align with the API spec. - HostedRunner: ImageDetails/image_details -> Image/image - HostedRunnerImageDetail: SizeGB/size_gb -> Size/size BREAKING CHANGE: Renamed Go struct fields (ImageDetails -> Image, SizeGB -> Size) and their JSON tags. The old JSON tags never matched the API, so this is effectively a bugfix. Supersedes google#4102
HostedRunner image struct fields and JSON tags to match API
HostedRunner image struct fields and JSON tags to match APIHostedRunner image struct fields and JSON tags to match API
alexandear
reviewed
Mar 18, 2026
| RunnerGroupID *int64 `json:"runner_group_id,omitempty"` | ||
| Platform *string `json:"platform,omitempty"` | ||
| ImageDetails *HostedRunnerImageDetail `json:"image_details,omitempty"` | ||
| Image *HostedRunnerImageDetail `json:"image,omitempty"` |
Contributor
There was a problem hiding this comment.
According to https://docs.github.com/en/rest/actions/hosted-runners?apiVersion=2022-11-28#list-github-hosted-runners-for-an-organization, HostedRunner contains the image_details field and not image.
Currently, the library uses 2022-11-28 API version:
Line 41 in 247ddc3
This PR should be done as part of #4077
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix incorrect JSON field names on
HostedRunnerandHostedRunnerImageDetailstructs that don't match the GitHub API response, and rename the Go struct fields to align with the API spec.Supersedes #4102 — recreated as a single commit under my identity to resolve a CLA issue caused by a Copilot-authored gofmt commit in the original PR.
Problem
The
HostedRunnerstruct usesjson:"image_details"but the GitHub API returns the field as"image". Similarly,HostedRunnerImageDetail.SizeGBusesjson:"size_gb"but the API returns"size".This means API responses were not being deserialized correctly into these structs.
Changes
HostedRunnerImageDetails/json:"image_details"Image/json:"image"HostedRunnerImageDetailSizeGB/json:"size_gb"Size/json:"size"Both Go field names and JSON tags are updated to match the API spec. Accessors regenerated via
go generate.Breaking Change
This is a breaking change for anyone referencing the old Go field names (
ImageDetails,SizeGB) or constructing JSON with the old field names. However, actual API responses were never being parsed correctly with the old tags, so this is effectively a bugfix.Testing