Skip to content

Commit bf33ab7

Browse files
authored
V10.1.0/minimal api support (#28)
✅ add tests for yaml formatter options and exception response formatter 📦️ updated NuGet package definition ⬆️ bump docfx version to 2.78.5 in Dockerfile 💬 updated community health pages
1 parent 899f203 commit bf33ab7

File tree

8 files changed

+140
-23
lines changed

8 files changed

+140
-23
lines changed

.docfx/Dockerfile.docfx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
FROM --platform=$BUILDPLATFORM nginx:${NGINX_VERSION} AS base
44
RUN rm -rf /usr/share/nginx/html/*
55

6-
FROM --platform=$BUILDPLATFORM codebeltnet/docfx:2.78.4 AS build
6+
FROM --platform=$BUILDPLATFORM codebeltnet/docfx:2.78.5 AS build
77

88
ADD [".", "docfx"]
99

.nuget/Codebelt.Extensions.AspNetCore.Mvc.Formatters.Text.Yaml/PackageReleaseNotes.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
Version: 10.0.4
1+
Version: 10.1.0
22
Availability: .NET 10 and .NET 9
3-
4-
# ALM
5-
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
6-
3+
4+
# ALM
5+
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
6+
77
Version: 10.0.3
88
Availability: .NET 10 and .NET 9
99

.nuget/Codebelt.Extensions.AspNetCore.Text.Yaml/PackageReleaseNotes.txt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
Version: 10.0.4
1+
Version: 10.1.0
22
Availability: .NET 10 and .NET 9
3-
4-
# ALM
5-
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
6-
3+
4+
# ALM
5+
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
6+
7+
# New Features
8+
- ADDED ServiceCollectionExtensions class in the Codebelt.Extensions.AspNetCore.Text.Yaml namespace with AddMinimalYamlOptions method
9+
 
10+
# Improvements
11+
- CHANGED ServiceCollectionExtensions class in the Codebelt.Extensions.AspNetCore.Text.Yaml.Formatters namespace so AddYamlFormatterOptions uses TryConfigure to avoid duplicate option registrations
12+
713
Version: 10.0.3
814
Availability: .NET 10 and .NET 9
915

.nuget/Codebelt.Extensions.YamlDotNet.App/PackageReleaseNotes.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
Version: 10.0.4
1+
Version: 10.1.0
22
Availability: .NET 10 and .NET 9
3-
4-
# ALM
5-
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
6-
3+
4+
# ALM
5+
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
6+
77
Version: 10.0.3
88
Availability: .NET 10 and .NET 9
99

.nuget/Codebelt.Extensions.YamlDotNet/PackageReleaseNotes.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
Version: 10.0.4
1+
Version: 10.1.0
22
Availability: .NET 10, .NET 9 and .NET Standard 2.0
3-
4-
# ALM
5-
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
6-
3+
4+
# ALM
5+
- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs)
6+
77
Version: 10.0.3
88
Availability: .NET 10, .NET 9 and .NET Standard 2.0
99

CHANGELOG.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,21 @@ For more details, please refer to `PackageReleaseNotes.txt` on a per assembly ba
77
> [!NOTE]
88
> Changelog entries prior to version 8.4.0 was migrated from previous versions of `Cuemon.Extensions.YamlDotNet`, `Cuemon.Extensions.AspNetCore`, `Cuemon.Extensions.AspNetCore.Mvc` and `Cuemon.Extensions.Diagnostics`.
99
10-
## [10.0.4] - 2026-02-28
10+
## [10.1.0] - 2026-02-28
1111

12-
This is a service update that focuses on package dependencies.
12+
This is a minor release that improves minimal API formatter integration, while also tightening option registration behavior across ASP.NET Core formatter setup.
13+
14+
### Added
15+
16+
- `ServiceCollectionExtensions` class in the Codebelt.Extensions.AspNetCore.Text.Yaml namespace was extended with a new method: `AddMinimalYamlOptions`.
17+
18+
### Changed
19+
20+
- `ServiceCollectionExtensions` class in the Codebelt.Extensions.AspNetCore.Text.Yaml.Formatters namespace to use TryConfigure in `AddYamlFormatterOptions`.
21+
22+
### Fixed
23+
24+
- Prevented repeated `IConfigureOptions<TOptions>` registrations when formatter/options extension methods are called multiple times.
1325

1426
## [10.0.3] - 2026-02-20
1527

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using System;
2+
using System.Linq;
3+
using Codebelt.Extensions.Xunit;
4+
using Codebelt.Extensions.YamlDotNet.Formatters;
5+
using Cuemon.AspNetCore.Diagnostics;
6+
using Cuemon.Diagnostics;
7+
using Microsoft.Extensions.DependencyInjection;
8+
using Microsoft.Extensions.Options;
9+
using Xunit;
10+
11+
namespace Codebelt.Extensions.AspNetCore.Text.Yaml.Formatters
12+
{
13+
public class ServiceCollectionExtensionsTest : Test
14+
{
15+
public ServiceCollectionExtensionsTest(ITestOutputHelper output) : base(output)
16+
{
17+
}
18+
19+
[Fact]
20+
public void AddYamlFormatterOptions_ShouldThrowArgumentNullException_WhenServicesIsNull()
21+
{
22+
Assert.Throws<ArgumentNullException>(() => ((IServiceCollection)null).AddYamlFormatterOptions());
23+
}
24+
25+
[Fact]
26+
public void AddYamlFormatterOptions_ShouldOnlyRegisterOptionsOnce()
27+
{
28+
var services = new ServiceCollection();
29+
services.AddOptions();
30+
services.AddYamlFormatterOptions(o => o.SensitivityDetails = FaultSensitivityDetails.All);
31+
services.AddYamlFormatterOptions(o => o.SensitivityDetails = FaultSensitivityDetails.None);
32+
33+
var count = services.Count(sd => sd.ServiceType == typeof(IConfigureOptions<YamlFormatterOptions>));
34+
35+
TestOutput.WriteLine($"IConfigureOptions<YamlFormatterOptions> registration count: {count}");
36+
37+
Assert.Equal(1, count);
38+
}
39+
40+
[Fact]
41+
public void AddYamlExceptionResponseFormatter_ShouldThrowArgumentNullException_WhenServicesIsNull()
42+
{
43+
Assert.Throws<ArgumentNullException>(() => ((IServiceCollection)null).AddYamlExceptionResponseFormatter());
44+
}
45+
46+
[Fact]
47+
public void AddYamlExceptionResponseFormatter_ShouldOnlyRegisterFormatterOnce()
48+
{
49+
var services = new ServiceCollection();
50+
services.AddOptions();
51+
services.AddYamlExceptionResponseFormatter();
52+
services.AddYamlExceptionResponseFormatter();
53+
54+
var count = services.Count(sd => sd.ServiceType == typeof(HttpExceptionDescriptorResponseFormatter<YamlFormatterOptions>));
55+
56+
TestOutput.WriteLine($"HttpExceptionDescriptorResponseFormatter<YamlFormatterOptions> registration count: {count}");
57+
58+
Assert.Equal(1, count);
59+
}
60+
}
61+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using System.Linq;
3+
using Codebelt.Extensions.AspNetCore.Text.Yaml.Formatters;
4+
using Codebelt.Extensions.Xunit;
5+
using Codebelt.Extensions.YamlDotNet.Formatters;
6+
using Cuemon.AspNetCore.Diagnostics;
7+
using Microsoft.Extensions.DependencyInjection;
8+
using Xunit;
9+
10+
namespace Codebelt.Extensions.AspNetCore.Text.Yaml
11+
{
12+
public class ServiceCollectionExtensionsTest : Test
13+
{
14+
public ServiceCollectionExtensionsTest(ITestOutputHelper output) : base(output)
15+
{
16+
}
17+
18+
[Fact]
19+
public void AddMinimalYamlOptions_ShouldThrowArgumentNullException_WhenServicesIsNull()
20+
{
21+
Assert.Throws<ArgumentNullException>(() => ((IServiceCollection)null).AddMinimalYamlOptions());
22+
}
23+
24+
[Fact]
25+
public void AddMinimalYamlOptions_ShouldRegisterYamlExceptionResponseFormatter()
26+
{
27+
var services = new ServiceCollection();
28+
services.AddOptions();
29+
services.AddMinimalYamlOptions();
30+
31+
var count = services.Count(sd => sd.ServiceType == typeof(HttpExceptionDescriptorResponseFormatter<YamlFormatterOptions>));
32+
33+
TestOutput.WriteLine($"HttpExceptionDescriptorResponseFormatter<YamlFormatterOptions> registration count: {count}");
34+
35+
Assert.Equal(1, count);
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)