Removed hardcoded API version for resourceTypes#188
Removed hardcoded API version for resourceTypes#188willtsai merged 4 commits intoradius-project:mainfrom
Conversation
|
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>
0585342 to
2c206d5
Compare
This is now done, thanks. |
|
thank you much for contributing! Could you please add test cases to cover the new functionality too? |
merging back from radius-dashboard
c746648 to
682c5f5
Compare
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>
682c5f5 to
b49ff72
Compare
|
Tests added |
Thanks, @ntyrewalla, for adding the tests. @nithyatsu will do a deeper review. In the meantime, can you run |
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>
done |
|
I've confirmed this works in a local build, so I will merge it now. Thanks for your contribution @ntyrewalla!
|

This pull request enhances the
RadiusApiimplementation 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:
makePathForIdandmakePathto accept an optionalcustomApiVersionparameter, allowing callers to specify which API version to use for a given resource.getBestApiVersionhelper.Helper methods for resource type and version:
getBestApiVersion, which fetches available API versions for a resource type and selects the most appropriate one, falling back to a default if necessary.extractResourceTypeFromId, which parses a resource ID to extract the resource type for version selection.# DescriptionPlease explain the changes you've made.
Type of change
Fixes: #181

Screenshots