feat: Refactor API structure to introduce versioned interfaces#666
Merged
frasermolyneux merged 1 commit intomainfrom Feb 21, 2026
Merged
feat: Refactor API structure to introduce versioned interfaces#666frasermolyneux merged 1 commit intomainfrom
frasermolyneux merged 1 commit intomainfrom
Conversation
…prove client access to health and info endpoints
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
Contributor
🏗️ Terraform Plan
✅ Validate — Passed ✅ Plan
📋 Resource Details
|
There was a problem hiding this comment.
Pull request overview
This pull request refactors the API client structure to use versioned interfaces for all endpoints (ApiInfo, ApiHealth, and GeoLookup), ensuring consistency across the client API surface. It also updates the APIM product policy to allow anonymous access to health and info endpoints.
Changes:
- Introduced
IVersionedApiInfoApiandIVersionedApiHealthApiinterfaces with their implementations, aligning the API info and health endpoints with the existing versioned pattern used for GeoLookup - Updated
IGeoLocationApiClientto expose versioned properties for all endpoints, requiring consumers to access endpoints via.V1property (e.g.,client.ApiInfo.V1.GetApiInfo()) - Modified APIM product policy to conditionally bypass JWT validation for health and info endpoints while requiring authentication for all other endpoints
Reviewed changes
Copilot reviewed 14 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| terraform/azurerm_api_management_product_policy.tf | Added conditional JWT validation with regex pattern to allow anonymous access to health and info endpoints |
| src/MX.GeoLocation.Api.V1/Program.cs | Added root endpoint for basic connectivity checks |
| src/MX.GeoLocation.Api.Client.V1/ServiceCollectionExtensions.cs | Removed redundant using statement and registered new versioned interface implementations |
| src/MX.GeoLocation.Api.Client.V1/IGeoLocationApiClient.cs | Updated properties to use versioned interfaces for ApiInfo and ApiHealth |
| src/MX.GeoLocation.Api.Client.V1/GeoLocationApiClient.cs | Updated constructor and properties to use versioned interfaces |
| src/MX.GeoLocation.Api.Client.V1/ApiVersionSelectors.cs | Defined new version selector interfaces for ApiHealth and ApiInfo |
| src/MX.GeoLocation.Api.Client.V1/ApiVersionSelectorImplementations.cs | Implemented version selector wrapper classes for ApiHealth and ApiInfo |
| src/MX.GeoLocation.Api.Client.V1/Api/V1/ApiInfoApi.cs | New file implementing the API info endpoint client |
| src/MX.GeoLocation.Api.Client.V1/Api/V1/ApiHealthApi.cs | New file implementing the API health endpoint client |
| src/MX.GeoLocation.Api.Client.Testing/ServiceCollectionExtensions.cs | Registered new versioned interfaces in the fake client setup |
| src/MX.GeoLocation.Api.Client.Testing/FakeGeoLocationApiClient.cs | Added fake implementations for new versioned interfaces |
| src/MX.GeoLocation.Api.Client.Testing.Tests/ServiceCollectionExtensionsTests.cs | Added assertions for new versioned interface registrations |
| src/MX.GeoLocation.Api.Client.Testing.Tests/FakeGeoLocationApiClientTests.cs | Updated tests to use versioned access pattern (.V1 property) |
| src/MX.GeoLocation.Abstractions.V1/README.md | Updated documentation to clarify version selector interfaces are in client package |
| src/MX.GeoLocation.Abstractions.V1/Interfaces/IVersionedGeoLookupApi.cs | Removed file, moved interface to client package |
| docs/testing.md | Updated documentation to reflect versioned access pattern for health and info endpoints |
This was referenced Feb 22, 2026
This was referenced Mar 8, 2026
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.



This pull request introduces version selector interfaces and implementations for the
ApiInfoandApiHealthendpoints, aligning them with the existing versioned pattern used forGeoLookup. The changes update the client, fakes, service registration, and documentation to ensure all API endpoints are accessed through versioned selectors, improving consistency and extensibility. Additionally, the API Management policy is updated to allow anonymous access to health and info endpoints.API Versioning and Client Updates:
IVersionedApiHealthApiandIVersionedApiInfoApiinterfaces, and their implementations (VersionedApiHealthApi,VersionedApiInfoApi) to provide versioned access to health and info endpoints, similar toIVersionedGeoLookupApi. [1] [2]IGeoLocationApiClientandGeoLocationApiClientto exposeApiInfoandApiHealthas versioned properties (IVersionedApiInfoApi,IVersionedApiHealthApi) instead of direct endpoint interfaces. [1] [2] [3]IVersionedGeoLookupApiinterface from the abstractions package and clarified in documentation that version selector interfaces are defined in the client package. [1] [2]Testing and Fakes:
FakeVersionedApiHealthApiandFakeVersionedApiInfoApiclasses for testing, updatedFakeGeoLocationApiClientto use these, and adjusted tests to access versioned endpoints (ApiInfo.V1,ApiHealth.V1). [1] [2] [3] [4] [5]API Management Policy:
/vX/healthand/vX/infoendpoints, while requiring JWT validation for all other endpoints. [1] [2]Other:
"/") to the API for health checks or basic connectivity.These changes collectively standardize versioning across all API endpoints, simplify future version additions, and improve testability and security configuration.