From e13b0b853e2cc994660dd3b430e9020fd6100278 Mon Sep 17 00:00:00 2001 From: Jason Barden Date: Fri, 2 May 2025 23:30:40 +0100 Subject: [PATCH 1/2] Drop AStar.Dev.Functional.Extensions for CSharpFunctionalExtensions --- .../AStar.Dev.Api.HealthChecks.csproj | 4 ++-- .../AStar.Dev.Api.HealthChecks.xml | 22 ++++++++++++++---- .../HealthStatusResponse.cs | 7 ++++++ src/AStar.Dev.Api.HealthChecks/IApiClient.cs | 4 ++-- src/AStar.Dev.Api.HealthChecks/Readme.md | 23 ++++++++++++++++++- ...tar.Dev.Api.HealthChecks.Tests.Unit.csproj | 2 +- .../HealthCheckExtensionsShould.cs | 2 +- .../HealthStatusResponseShould.cs | 3 ++- 8 files changed, 54 insertions(+), 13 deletions(-) diff --git a/src/AStar.Dev.Api.HealthChecks/AStar.Dev.Api.HealthChecks.csproj b/src/AStar.Dev.Api.HealthChecks/AStar.Dev.Api.HealthChecks.csproj index 8f79edc..31447fc 100644 --- a/src/AStar.Dev.Api.HealthChecks/AStar.Dev.Api.HealthChecks.csproj +++ b/src/AStar.Dev.Api.HealthChecks/AStar.Dev.Api.HealthChecks.csproj @@ -43,7 +43,7 @@ - + @@ -60,7 +60,7 @@ true - + \ diff --git a/src/AStar.Dev.Api.HealthChecks/AStar.Dev.Api.HealthChecks.xml b/src/AStar.Dev.Api.HealthChecks/AStar.Dev.Api.HealthChecks.xml index 6a056ae..3f0a6a0 100644 --- a/src/AStar.Dev.Api.HealthChecks/AStar.Dev.Api.HealthChecks.xml +++ b/src/AStar.Dev.Api.HealthChecks/AStar.Dev.Api.HealthChecks.xml @@ -6,15 +6,25 @@ - The class contains the relevant method(s) to configure the endpoints. + The + + class contains the relevant method(s) to configure the endpoints. - The method will add a basic health/live and health/ready endpoint. + The + + method will add a basic health/live and health/ready endpoint. - An instance of to configure - The original to facilitate further method chaining + An instance of + + to configure + + The original + + to facilitate further method chaining + @@ -55,7 +65,9 @@ The token to optionally use to cancel the operation - An instance of the class wrapping an instance of the class when successful (containing the text representation of + An instance of the + + class wrapping an instance of the class when successful (containing the text representation of the API Health Status). When the call fails, a string error message will be returned diff --git a/src/AStar.Dev.Api.HealthChecks/HealthStatusResponse.cs b/src/AStar.Dev.Api.HealthChecks/HealthStatusResponse.cs index 0c7b5d8..f0a2255 100644 --- a/src/AStar.Dev.Api.HealthChecks/HealthStatusResponse.cs +++ b/src/AStar.Dev.Api.HealthChecks/HealthStatusResponse.cs @@ -1,30 +1,37 @@ namespace AStar.Dev.Api.HealthChecks; /// +/// The class contains a strongly-typed response for the Health Checks to use /// public sealed record HealthStatusResponse { /// + /// Gets or sets the name of the Health Check /// public string Name { get; set; } = string.Empty; /// + /// Gets or sets the description of the Health Status response /// public string? Description { get; set; } = "Unable to retrieve the description of the Health Status"; /// + /// Gets or sets the Status of the Health Status response /// public string Status { get; set; } = string.Empty; /// + /// Gets or sets the milliseconds the Health Check took to complete /// public double DurationInMilliseconds { get; set; } /// + /// TBH, not sure if this is populated anywhere at the time of writing /// public IReadOnlyDictionary? Data { get; set; } /// + /// Gets or sets the (or derived type) encountered during the Health Check call /// public string? Exception { get; set; } = string.Empty; } diff --git a/src/AStar.Dev.Api.HealthChecks/IApiClient.cs b/src/AStar.Dev.Api.HealthChecks/IApiClient.cs index 345fc6c..cc1be23 100644 --- a/src/AStar.Dev.Api.HealthChecks/IApiClient.cs +++ b/src/AStar.Dev.Api.HealthChecks/IApiClient.cs @@ -1,4 +1,4 @@ -using AStar.Dev.Functional.Extensions; +using CSharpFunctionalExtensions; namespace AStar.Dev.Api.HealthChecks; @@ -12,7 +12,7 @@ public interface IApiClient /// /// The token to optionally use to cancel the operation /// - /// An instance of the class wrapping an instance of the class when successful (containing the text representation of + /// An instance of the class wrapping an instance of the class when successful (containing the text representation of /// the API Health Status). When the call fails, a string error message will be returned /// public Task> GetHealthCheckAsync(CancellationToken cancellationToken = default); diff --git a/src/AStar.Dev.Api.HealthChecks/Readme.md b/src/AStar.Dev.Api.HealthChecks/Readme.md index 16dacd1..f5c90d6 100644 --- a/src/AStar.Dev.Api.HealthChecks/Readme.md +++ b/src/AStar.Dev.Api.HealthChecks/Readme.md @@ -1 +1,22 @@ -Update \ No newline at end of file +# AStar.Dev.Api.HealthChecks + +This NuGet package, as the name suggests, contains the generic methods for making Health-Check calls to the AStar Dev APIs + +## GitHub build + +[![.NET](https://github.com/astar-development/astar-dev-api-health-checks/actions/workflows/dotnet.yml/badge.svg)](https://github.com/astar-development/astar-dev-api-health-checks/actions/workflows/dotnet.yml) + +## SonarCloud Analysis Results + +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=jbarden_astar-dev-api-health-checks&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=jbarden_astar-dev-api-health-checks) + +[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=jbarden_astar-dev-api-health-checks&metric=bugs)](https://sonarcloud.io/summary/new_code?id=jbarden_astar-dev-api-health-checks) + +[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=jbarden_astar-dev-api-health-checks&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=jbarden_astar-dev-api-health-checks) + +[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=jbarden_astar-dev-api-health-checks&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=jbarden_astar-dev-api-health-checks) + +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=jbarden_astar-dev-api-health-checks&metric=coverage)](https://sonarcloud.io/summary/new_code?id=jbarden_astar-dev-api-health-checks) + +[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=jbarden_astar-dev-api-health-checks&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=jbarden_astar-dev-api-health-checks) + diff --git a/test/AStar.Dev.Api.HealthChecks.Tests.Unit/AStar.Dev.Api.HealthChecks.Tests.Unit.csproj b/test/AStar.Dev.Api.HealthChecks.Tests.Unit/AStar.Dev.Api.HealthChecks.Tests.Unit.csproj index 608b548..e89ce2a 100644 --- a/test/AStar.Dev.Api.HealthChecks.Tests.Unit/AStar.Dev.Api.HealthChecks.Tests.Unit.csproj +++ b/test/AStar.Dev.Api.HealthChecks.Tests.Unit/AStar.Dev.Api.HealthChecks.Tests.Unit.csproj @@ -15,7 +15,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/AStar.Dev.Api.HealthChecks.Tests.Unit/HealthCheckExtensionsShould.cs b/test/AStar.Dev.Api.HealthChecks.Tests.Unit/HealthCheckExtensionsShould.cs index 94b7ba2..eb3c6b8 100644 --- a/test/AStar.Dev.Api.HealthChecks.Tests.Unit/HealthCheckExtensionsShould.cs +++ b/test/AStar.Dev.Api.HealthChecks.Tests.Unit/HealthCheckExtensionsShould.cs @@ -6,7 +6,7 @@ namespace AStar.Dev.Api.HealthChecks; [TestSubject(typeof(HealthCheckExtensions))] -public class HealthCheckExtensionsShould() +public class HealthCheckExtensionsShould { [Fact] public void ConfigureTheHealthCheckEndpoints() diff --git a/test/AStar.Dev.Api.HealthChecks.Tests.Unit/HealthStatusResponseShould.cs b/test/AStar.Dev.Api.HealthChecks.Tests.Unit/HealthStatusResponseShould.cs index 0dafd94..cf90ed1 100644 --- a/test/AStar.Dev.Api.HealthChecks.Tests.Unit/HealthStatusResponseShould.cs +++ b/test/AStar.Dev.Api.HealthChecks.Tests.Unit/HealthStatusResponseShould.cs @@ -9,7 +9,8 @@ public class HealthStatusResponseShould [Fact] public void ContainTheExpectedProperties() { - new HealthStatusResponse(){Name = "Test Name", Description = "Test Description", DurationInMilliseconds = 123, Data = new Dictionary(), Exception = "Test Exception", Status = "OK"} + new HealthStatusResponse + { Name = "Test Name", Description = "Test Description", DurationInMilliseconds = 123, Data = new Dictionary(), Exception = "Test Exception", Status = "OK" } .ToJson().ShouldMatchApproved(); } } From de5e004613cc97dd88a78035f1d5b9d0b604ea8d Mon Sep 17 00:00:00 2001 From: Jason Barden Date: Fri, 2 May 2025 23:35:16 +0100 Subject: [PATCH 2/2] Missed updating the NuGet version --- .../AStar.Dev.Api.HealthChecks.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AStar.Dev.Api.HealthChecks/AStar.Dev.Api.HealthChecks.csproj b/src/AStar.Dev.Api.HealthChecks/AStar.Dev.Api.HealthChecks.csproj index 31447fc..76c6f56 100644 --- a/src/AStar.Dev.Api.HealthChecks/AStar.Dev.Api.HealthChecks.csproj +++ b/src/AStar.Dev.Api.HealthChecks/AStar.Dev.Api.HealthChecks.csproj @@ -21,7 +21,7 @@ LICENSE https://github.com/astar-development/astar-dev-api-health-checks Readme.md - Removes the defunct Health Check, leaving the 'Result' object-based version. + Drop AStar.Dev.Function.Extensions for CSharpFunctionalExtensions true ASP.Core HealthChecks;HealthChecks git @@ -29,7 +29,7 @@ snupkg net9.0 AStar API HealthChecks - 0.4.1 + 0.4.2