fix: Correct GetRegionAvailability response type#897
fix: Correct GetRegionAvailability response type#897zliang-akamai merged 2 commits intolinode:mainfrom
Conversation
The regions/{regionID}/availability API endpoint returns a JSON array
of availability records (one per plan), not a single object.
https://techdocs.akamai.com/linode-api/reference/get-region-availability
There was a problem hiding this comment.
Pull request overview
This PR fixes the response type for the GetRegionAvailability function to correctly return an array of availability records (one per plan) instead of a single object, aligning with the actual Linode API behavior documented at https://techdocs.akamai.com/linode-api/reference/get-region-availability.
Changes:
- Updated
GetRegionAvailabilityto return[]RegionAvailabilityinstead of*RegionAvailability - Modified caching logic to properly handle array responses
- Updated test fixture and assertions to match the corrected array response format
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| regions_availability.go | Changed return type from pointer to single object to array, updated response handling and caching logic |
| test/unit/region_test.go | Updated test assertions to access array elements instead of direct object properties |
| test/unit/fixtures/region_availability_get.json | Changed fixture from single object to array containing availability records |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I can confirm that this is an issue. I get this error when calling |
e11f5c2 to
965df95
Compare
|
Awaiting #898 |
yec-akamai
left a comment
There was a problem hiding this comment.
Unit test passed on my end, thanks for putting up the fix!
@psnoch-akamai Can we add integration test for this endpoint later?
ezilber-akamai
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
The regions/{regionID}/availability API endpoint returns a JSON array of availability records (one per plan), not a single object.
https://techdocs.akamai.com/linode-api/reference/get-region-availability
✔️ How to Test
https://gist.github.com/glennpratt/e427a03cb749ccec3c3041c6e6396aea