Skip to content

Refactor API structure#933

Merged
frasermolyneux merged 2 commits intomainfrom
feature/api-meta-endpoint
Feb 21, 2026
Merged

Refactor API structure#933
frasermolyneux merged 2 commits intomainfrom
feature/api-meta-endpoint

Conversation

@frasermolyneux
Copy link
Owner

This pull request introduces two new API interfaces—IApiHealthApi and IApiInfoApi—and removes the legacy IRootApi interface and its related implementations. The changes modernize the API client by providing explicit health and info endpoints, updating the fake/test clients, and ensuring proper dependency injection registration. The most important changes are grouped below by theme.

API Interface Changes:

  • Added new interfaces IApiHealthApi and IApiInfoApi for health check and API info functionality, replacing the previous root endpoint abstraction. (src/XtremeIdiots.Portal.Integrations.Servers.Abstractions.V1/Interfaces/V1/IApiHealthApi.cs, src/XtremeIdiots.Portal.Integrations.Servers.Abstractions.V1/Interfaces/V1/IApiInfoApi.cs) [1] [2]
  • Removed the legacy IRootApi interface and its implementation, deprecating the root endpoint in favor of explicit health/info endpoints. (src/XtremeIdiots.Portal.Integrations.Servers.Abstractions.V1/Interfaces/V1/IRootApi.cs, src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.V1/Api/V1/RootApi.cs) [1] [2]

API Client Implementation:

  • Added implementations for ApiHealthApi and ApiInfoApi in the client, providing health check and info retrieval functionality. (src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.V1/Api/V1/ApiHealthApi.cs, src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.V1/Api/V1/ApiInfoApi.cs) [1] [2]
  • Introduced ApiInfoDto model for API info responses. (src/XtremeIdiots.Portal.Integrations.Servers.Abstractions.V1/Models/ApiInfoDto.cs)

Testing and Dependency Injection Updates:

  • Updated fake/test clients and dependency injection registration to use FakeApiHealthApi and FakeApiInfoApi instead of FakeRootApi, and ensured all new interfaces are registered and tested. (src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.Testing/FakeApiHealthApi.cs, src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.Testing/FakeApiInfoApi.cs, src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.Testing/FakeServersApiClient.cs, src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.Testing.Tests/FakeApiHealthApiTests.cs, src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.Testing.Tests/ServiceCollectionExtensionsTests.cs, src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.Tests.V1/UnitTest1.cs) [1] [2] [3] [4] [5] [6]

These changes collectively update the API abstraction to be more explicit and robust, improve testability, and ensure proper dependency injection for the new endpoints.

…e IApiHealthApi and IApiInfoApi

- Deleted IRootApi interface and its implementation.
- Introduced IApiHealthApi and IApiInfoApi interfaces for health and info endpoints.
- Updated FakeRootApi to FakeApiHealthApi and added FakeApiInfoApi for testing.
- Modified ServersApiClient to use new API interfaces.
- Updated ServiceCollectionExtensions to register new API clients.
- Refactored health check logic to utilize IApiHealthApi.
- Adjusted tests to reflect changes in API structure and functionality.
Copilot AI review requested due to automatic review settings February 21, 2026 20:11
@github-actions
Copy link
Contributor

github-actions bot commented Feb 21, 2026

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
See the Details below.

License Issues

src/XtremeIdiots.Portal.Integrations.Servers.Api.V1/XtremeIdiots.Portal.Integrations.Servers.Api.V1.csproj

PackageVersionLicenseIssue Type
XtremeIdiots.Portal.Repository.Api.Client.V12.1.139NullUnknown License

OpenSSF Scorecard

PackageVersionScoreDetails
nuget/XtremeIdiots.Portal.Repository.Api.Client.V1 2.1.139 UnknownUnknown

Scanned Files

  • src/XtremeIdiots.Portal.Integrations.Servers.Api.V1/XtremeIdiots.Portal.Integrations.Servers.Api.V1.csproj

@github-actions
Copy link
Contributor

github-actions bot commented Feb 21, 2026

Superseded — A newer run has replaced this result.

🏗️ Terraform Plan

🌍 Environment: dev

✅ Validate — Passed

✅ Plan

Count
🔄 Change 1
📋 Resource Details
Action Resource
🔄 Update azurerm_api_management_product_policy.api_product_policy

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the Servers API client surface by replacing the legacy “root” endpoint abstraction with explicit health and info API interfaces, and updates DI + testing helpers accordingly. It also adjusts APIM policy to allow anonymous access to the health/info endpoints and updates the API’s dependency health check implementation.

Changes:

  • Replace IRootApi with IApiHealthApi and IApiInfoApi (contracts + client implementations + version selectors).
  • Update DI registrations and all fake/testing clients to expose health/info instead of root.
  • Update APIM product policy to exempt /vX(.Y)/(health|info) from JWT validation; update repository health check to call the Repository API’s health endpoint via its client.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
terraform/azurerm_api_management_product_policy.tf Exempts versioned /health and /info routes from JWT validation in APIM.
src/XtremeIdiots.Portal.Integrations.Servers.Api.V1/XtremeIdiots.Portal.Integrations.Servers.Api.V1.csproj Bumps Repository API client package version.
src/XtremeIdiots.Portal.Integrations.Servers.Api.V1/Program.cs Adds a minimal root endpoint mapping.
src/XtremeIdiots.Portal.Integrations.Servers.Api.V1/OpenApi/StripVersionPrefixTransformer.cs Updates doc comment for version-prefix stripping behavior.
src/XtremeIdiots.Portal.Integrations.Servers.Api.V1/HealthChecks/RepositoryApiHealthCheck.cs Uses Repository API client’s health endpoint instead of raw HttpClient + config.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.V1/ServiceCollectionExtensions.cs Registers typed clients + version selectors for new health/info APIs.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.V1/ServersApiClient.cs Replaces Root with ApiHealth/ApiInfo on the unified client.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.V1/IServersApiClient.cs Updates contract to expose ApiHealth/ApiInfo instead of Root.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.V1/ApiVersionSelectors.cs Replaces IVersionedRootApi with versioned health/info selector interfaces.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.V1/ApiVersionSelectorImplementations.cs Adds version selector implementations for health/info.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.V1/Api/V1/RootApi.cs Removes legacy Root API implementation.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.V1/Api/V1/ApiInfoApi.cs Adds client implementation for /v1/info.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.V1/Api/V1/ApiHealthApi.cs Adds client implementation for /v1/health.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.Tests.V1/UnitTest1.cs Updates DI resolution tests for new versioned APIs.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.Testing/ServiceCollectionExtensions.cs Updates fake DI wiring to register health/info fakes and selectors.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.Testing/FakeServersApiClient.cs Updates fake unified client to delegate to health/info fakes.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.Testing/FakeApiInfoApi.cs Adds an in-memory fake for IApiInfoApi.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.Testing/FakeApiHealthApi.cs Renames/reworks fake root API into FakeApiHealthApi.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.Testing.Tests/ServiceCollectionExtensionsTests.cs Updates fake DI tests for new health/info registrations.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.Testing.Tests/FakeServersApiClientTests.cs Updates delegation tests for fake unified client.
src/XtremeIdiots.Portal.Integrations.Servers.Api.Client.Testing.Tests/FakeApiHealthApiTests.cs Renames/updates tests to cover the health fake.
src/XtremeIdiots.Portal.Integrations.Servers.Abstractions.V1/Models/ApiInfoDto.cs Introduces DTO for /info responses.
src/XtremeIdiots.Portal.Integrations.Servers.Abstractions.V1/Interfaces/V1/IRootApi.cs Removes legacy root interface.
src/XtremeIdiots.Portal.Integrations.Servers.Abstractions.V1/Interfaces/V1/IApiInfoApi.cs Adds explicit API info contract.
src/XtremeIdiots.Portal.Integrations.Servers.Abstractions.V1/Interfaces/V1/IApiHealthApi.cs Adds explicit API health contract.

@github-actions
Copy link
Contributor

🏗️ Terraform Plan

🌍 Environment: dev

✅ Validate — Passed

✅ Plan

Count
🔄 Change 1
📋 Resource Details
Action Resource
🔄 Update azurerm_api_management_product_policy.api_product_policy

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated 2 comments.

@sonarqubecloud
Copy link

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.

2 participants