fix!: Correct `HostedRunner` image struct fields and JSON tags to match API by austenstone · Pull Request #4102 · google/go-github

@austenstone

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

stevehipwell

@austenstone

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

Mar 17, 2026
…Detail structs

Co-authored-by: austenstone <22425467+austenstone@users.noreply.github.com>
Fix gofmt alignment in HostedRunnerImageDetail struct literals

@gmlewis 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

Mar 17, 2026

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