fix: Correct GetRegionAvailability response type#897
Open
glennpratt wants to merge 1 commit intolinode:mainfrom
Open
fix: Correct GetRegionAvailability response type#897glennpratt wants to merge 1 commit intolinode:mainfrom
glennpratt wants to merge 1 commit 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
Contributor
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
Author
|
Awaiting #898 |
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.
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