Skip to content

Removed hardcoded API version for resourceTypes#188

Merged
willtsai merged 4 commits intoradius-project:mainfrom
ntyrewalla:fix-custom-resource-api-version
Feb 12, 2026
Merged

Removed hardcoded API version for resourceTypes#188
willtsai merged 4 commits intoradius-project:mainfrom
ntyrewalla:fix-custom-resource-api-version

Conversation

@ntyrewalla
Copy link
Contributor

This pull request enhances the RadiusApi implementation to dynamically select the appropriate API version for resource requests based on the resource type, instead of always using a hardcoded default. This makes the API more robust and compatible with future changes in resource versions.

API version selection improvements:

  • Updated makePathForId and makePath to accept an optional customApiVersion parameter, allowing callers to specify which API version to use for a given resource.
  • When listing resources of a specific type, the code now determines and uses the best available API version for that type by calling the new getBestApiVersion helper.
  • When retrieving a specific resource by ID, the resource type is extracted from the ID, and the best API version is selected for the request if possible; otherwise, the default version is used.

Helper methods for resource type and version:

  • Added getBestApiVersion, which fetches available API versions for a resource type and selects the most appropriate one, falling back to a default if necessary.
  • Added extractResourceTypeFromId, which parses a resource ID to extract the resource type for version selection.# Description

Please explain the changes you've made.

Type of change

  • This pull request fixes a bug in Radius Dashboard and has an approved issue (issue link required).
  • This pull request adds or changes features of Radius Dashboard and has an approved issue (issue link required).
  • This pull request is a minor refactor, code cleanup, test improvement, or other maintenance task and doesn't change the functionality of Radius Dashboard (issue link optional).

Fixes: #181
Screenshot 2026-02-03 at 10 43 06 PM

Screenshots

@ntyrewalla ntyrewalla requested review from a team as code owners February 4, 2026 06:43
@Reshrahim
Copy link

Thank you for the contribution. We are currently reviewing the PR. While we do that, can you fix DCO by signing off your commit(s).

Signed-off-by: Niz <ntyrewalla@gmail.com>
@ntyrewalla ntyrewalla force-pushed the fix-custom-resource-api-version branch from 0585342 to 2c206d5 Compare February 6, 2026 20:35
@ntyrewalla
Copy link
Contributor Author

Thank you for the contribution. We are currently reviewing the PR. While we do that, can you fix DCO by signing off your commit(s).

This is now done, thanks.

@nithyatsu
Copy link
Contributor

thank you much for contributing! Could you please add test cases to cover the new functionality too?

merging back from radius-dashboard
@ntyrewalla ntyrewalla force-pushed the fix-custom-resource-api-version branch from c746648 to 682c5f5 Compare February 11, 2026 05:18
This commit adds extensive test coverage for the dynamic API version functionality that was recently implemented:

- Custom API version handling in makePath and makePathForId functions
- Resource type extraction from resource IDs with various formats
- Dynamic API version resolution via getBestApiVersion method
- Integration with listResources and getResourceById methods
- Error handling and edge cases for network failures, malformed responses, and invalid resource types

All 42 tests pass, verifying the robustness of the implementation.

Signed-off-by: Niz <ntyrewalla@gmail.com>
@ntyrewalla ntyrewalla force-pushed the fix-custom-resource-api-version branch from 682c5f5 to b49ff72 Compare February 11, 2026 05:25
@ntyrewalla
Copy link
Contributor Author

Tests added

@willtsai
Copy link
Contributor

willtsai commented Feb 11, 2026

Tests added

Thanks, @ntyrewalla, for adding the tests. @nithyatsu will do a deeper review.

In the meantime, can you run yarn run format:write to fix the formatting issues that are failing the build pipeline? You can also run yarn run lint:all to validate before pushing the code.

Apply Prettier formatting to improve code readability by breaking long function
calls across multiple lines and ensuring consistent style compliance.

- Format makePathForId function calls in tests
- Format getBestApiVersion function calls in API implementation

Signed-off-by: Niz <ntyrewalla@gmail.com>
@ntyrewalla
Copy link
Contributor Author

Tests added

Thanks, @ntyrewalla, for adding the tests. @nithyatsu will do a deeper review.

In the meantime, can you run yarn run format:write to fix the formatting issues that are failing the build pipeline? You can also run yarn run lint:all to validate before pushing the code.

done

Copy link
Contributor

@nithyatsu nithyatsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@willtsai
Copy link
Contributor

I've confirmed this works in a local build, so I will merge it now. Thanks for your contribution @ntyrewalla!

image

@willtsai willtsai merged commit ddbd2d9 into radius-project:main Feb 12, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard fails to display custom resource types with non-standard API versions

4 participants