fix!: Correct `HostedRunner` image struct fields and JSON tags to match API by austenstone · Pull Request #4102 · google/go-github
The HostedRunner struct used `json:"image_details"` for the image field and `json:"size_gb"` for the image size, but the GitHub API returns `"image"` and `"size"` respectively. This fixes deserialization of HostedRunner responses from the API. Changes: - HostedRunner.ImageDetails: json tag "image_details" -> "image" - HostedRunnerImageDetail.SizeGB: json tag "size_gb" -> "size" - Updated all test mock responses to use correct field names
Rename ImageDetails → Image and SizeGB → Size on HostedRunnerImageDetail to align Go field names with their JSON tags and the GitHub API. Regenerated accessors via go generate ./...
austenstone
changed the title
fix: Correct HostedRunner image JSON field names to match API
fix: Correct HostedRunner image struct fields and JSON tags to match API
gmlewis
changed the title
fix: Correct HostedRunner image struct fields and JSON tags to match API
fix!: Correct HostedRunner image struct fields and JSON tags to match API
austenstone added a commit to austenstone/go-github that referenced this pull request
Mar 17, 2026… 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
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