From 9b3e6af69980dfdc5b1289757ba9fdd3cfac268b Mon Sep 17 00:00:00 2001 From: "Jerrett D. Davis" Date: Sun, 14 Sep 2025 22:56:45 -0500 Subject: [PATCH] docs: further tweaked docs building and publishing to fix warnings. --- docs/index.md | 19 ++++--------------- .../Chain/AuthLoggingDemo.cs | 15 ++++----------- .../PatternKit.Generators.Abstractions.csproj | 2 ++ .../Creational/Builder/BranchBuilderTests.cs | 4 ++-- 4 files changed, 12 insertions(+), 28 deletions(-) diff --git a/docs/index.md b/docs/index.md index 761ba05..eeb0475 100644 --- a/docs/index.md +++ b/docs/index.md @@ -62,10 +62,10 @@ if (parser.Execute("123", out var value)) PatternKit will ultimately support the full spectrum of **creational**, **structural**, and **behavioral** patterns: -| Category | Patterns ✓ = Implemented | -| -------------- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| **Creational** | [Factory](xref:PatternKit.Creational) (planned) • [Builder](xref:PatternKit.Creational.Builder) (planned) • Prototype (planned) • Singleton (planned) | -| **Structural** | Adapter (planned) • Bridge (planned) • Composite (planned) • Decorator (planned) • Facade (planned) • Flyweight (planned) • Proxy (planned) | +| Category | Patterns ✓ = Implemented | +| -------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| **Creational** | Factory (planned) • [Builder](xref:PatternKit.Creational.Builder) (planned) • Prototype (planned) • Singleton (planned) | +| **Structural** | Adapter (planned) • Bridge (planned) • Composite (planned) • Decorator (planned) • Facade (planned) • Flyweight (planned) • Proxy (planned) | | **Behavioral** | [Strategy](xref:PatternKit.Behavioral.Strategy.Strategy`2) ✓ • [TryStrategy](xref:PatternKit.Behavioral.Strategy.TryStrategy`2) ✓ • Chain of Responsibility (planned) • Command (planned) • Iterator (planned) • Mediator (planned) • Memento (planned) • Observer (planned) • State (planned) • Template Method (planned) • Visitor (planned) | Each pattern ships with: @@ -98,14 +98,3 @@ public class StrategyTests : TinyBddXunitBase } ``` ---- - -## 🔗 Explore the API - -* [Behavioral Patterns](xref:PatternKit.Behavioral) -* [Creational Patterns](xref:PatternKit.Creational) -* [Structural Patterns](xref:PatternKit.Structural) -* [Common Utilities](xref:PatternKit.Common) - -> **Tip:** Use the search bar in the left navigation panel to quickly find classes, methods, and examples. - diff --git a/src/PatternKit.Examples/Chain/AuthLoggingDemo.cs b/src/PatternKit.Examples/Chain/AuthLoggingDemo.cs index e8595e1..8c1ea3a 100644 --- a/src/PatternKit.Examples/Chain/AuthLoggingDemo.cs +++ b/src/PatternKit.Examples/Chain/AuthLoggingDemo.cs @@ -13,13 +13,6 @@ namespace PatternKit.Examples.Chain; /// public readonly record struct HttpRequest(string Method, string Path, IReadOnlyDictionary Headers); -/// -/// Minimal HTTP-ish response. Included for completeness; not used by this specific demo. -/// -/// HTTP status code. -/// Payload body (if any). -public readonly record struct HttpResponse(int Status, string Body); - /// /// Demonstrates an over that composes /// request-id logging and an auth gate for /admin/* without if/else ladders. @@ -32,19 +25,19 @@ namespace PatternKit.Examples.Chain; /// /// /// Conditional log (continue): If X-Request-Id is present, -/// log reqid=<id> and continue (via ). +/// log reqid=<id> and continue (via ). /// /// /// /// /// Auth gate (stop): If the path starts with /admin and no Authorization header exists, /// log deny: missing auth and stop the chain early -/// (via ). +/// (via ). /// /// /// /// -/// Tail log (finally-on-continue): In +/// Tail log (finally-on-continue): In /// we log {Method} {Path}. This runs only if no prior step called ThenStop /// (strict-stop semantics). In other words, a Stop short-circuits the chain and /// prevents this tail from running. @@ -113,7 +106,7 @@ public static List Run() // admin requires auth (stop) .When(static (in r) => r.Path.StartsWith("/admin", StringComparison.Ordinal) && !r.Headers.ContainsKey("Authorization")) - .ThenStop(r => log.Add("deny: missing auth")) + .ThenStop(_ => log.Add("deny: missing auth")) // tail log (runs only if the chain wasn't stopped earlier) .Finally((in r, next) => diff --git a/src/PatternKit.Generators.Abstractions/PatternKit.Generators.Abstractions.csproj b/src/PatternKit.Generators.Abstractions/PatternKit.Generators.Abstractions.csproj index 0103330..e3be85d 100644 --- a/src/PatternKit.Generators.Abstractions/PatternKit.Generators.Abstractions.csproj +++ b/src/PatternKit.Generators.Abstractions/PatternKit.Generators.Abstractions.csproj @@ -3,6 +3,8 @@ netstandard2.0 PatternKit.Generators + true + true diff --git a/test/PatternKit.Tests/Creational/Builder/BranchBuilderTests.cs b/test/PatternKit.Tests/Creational/Builder/BranchBuilderTests.cs index 5cff75b..dd3ad59 100644 --- a/test/PatternKit.Tests/Creational/Builder/BranchBuilderTests.cs +++ b/test/PatternKit.Tests/Creational/Builder/BranchBuilderTests.cs @@ -135,8 +135,8 @@ public async Task Build_Snapshot_Immutability() }) .Then("P1 has 1 pair; P2 has 2 pairs", t => { - Assert.Equal(1, t.P1.Preds.Length); - Assert.Equal(1, t.P1.Handlers.Length); + Assert.Single(t.P1.Preds); + Assert.Single(t.P1.Handlers); Assert.Equal(2, t.P2.Preds.Length); Assert.Equal(2, t.P2.Handlers.Length);