feat: Swap Swagger UI with Scalar UI docs for Chapters 2, 3, and 4#245
Conversation
Agent-Logs-Url: https://github.com/evolutionary-architecture/evolutionary-architecture-by-example/sessions/30428a77-ae98-466a-b4cc-d62d9b803116 Co-authored-by: kamilbaczek <74410956+kamilbaczek@users.noreply.github.com>
| @@ -7,7 +7,7 @@ | |||
| public static class ApiDocumentationExtensions | |||
| { | |||
| public static void UseApiDocumentation(this IEndpointRouteBuilder app) => | |||
| app.MapGet("/", () => Results.Redirect("/swagger")) | |||
…nExtensions.cs Agent-Logs-Url: https://github.com/evolutionary-architecture/evolutionary-architecture-by-example/sessions/d326031b-41b8-4600-b88f-5b27bf3c62e7 Co-authored-by: kamilbaczek <74410956+kamilbaczek@users.noreply.github.com>
|
@copilot Error: /home/runner/work/evolutionary-architecture-by-example/evolutionary-architecture-by-example/Chapter-2-modules-separation/Src/Fitnet/obj/Debug/net10.0/Microsoft.AspNetCore.OpenApi.SourceGenerators/Microsoft.AspNetCore.OpenApi.SourceGenerators.XmlCommentGenerator/OpenApiXmlCommentSupport.generated.cs(596,10): error CS9137: The 'interceptors' feature is not enabled in this namespace. Add '$(InterceptorsNamespaces);Microsoft.AspNetCore.OpenApi.Generated' to your project. [/home/runner/work/evolutionary-architecture-by-example/evolutionary-architecture-by-example/Chapter-2-modules-separation/Src/Fitnet/Fitnet.csproj] |
…n Chapters 2-4 Agent-Logs-Url: https://github.com/evolutionary-architecture/evolutionary-architecture-by-example/sessions/b3fe24c9-f7cf-4856-98c0-65903980d0a5 Co-authored-by: kamilbaczek <74410956+kamilbaczek@users.noreply.github.com>
Fixed in 5ea6d71. The |
|
@copilot Error: /home/runner/work/evolutionary-architecture-by-example/evolutionary-architecture-by-example/Chapter-3-microservice-extraction/Fitnet/Src/Reports/Tests/Fitnet.Reports.IntegrationTests/GlobalUsings.cs(5,14): error CS0246: The type or namespace name 'FluentAssertions' could not be found (are you missing a using directive or an assembly reference?) [/home/runner/work/evolutionary-architecture-by-example/evolutionary-architecture-by-example/Chapter-3-microservice-extraction/Fitnet/Src/Reports/Tests/Fitnet.Reports.IntegrationTests/Fitnet.Reports.IntegrationTests.csproj] |
…n tests Agent-Logs-Url: https://github.com/evolutionary-architecture/evolutionary-architecture-by-example/sessions/6b607599-1f0f-4f2f-a06b-356b03a80841 Co-authored-by: kamilbaczek <74410956+kamilbaczek@users.noreply.github.com>
Fixed in 17035ec. |
|
@copilot Error: /home/runner/work/evolutionary-architecture-by-example/evolutionary-architecture-by-example/Chapter-2-modules-separation/Src/Common/Tests/Fitnet.Common.Infrastructure.IntegrationTests/Events/EventBus/InMemory/InMemoryEventBusTests.cs(22,23): error IDE0370: Suppression is unnecessary (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0370) [/home/runner/work/evolutionary-architecture-by-example/evolutionary-architecture-by-example/Chapter-2-modules-separation/Src/Common/Tests/Fitnet.Common.Infrastructure.IntegrationTests/Fitnet.Common.Infrastructure.IntegrationTests.csproj] |
…E0370) Agent-Logs-Url: https://github.com/evolutionary-architecture/evolutionary-architecture-by-example/sessions/c2d786d8-d144-4bc9-9459-5e1e33ecca4d Co-authored-by: kamilbaczek <74410956+kamilbaczek@users.noreply.github.com>
Fixed in 1e6d3e3. The |
📋 Description
Extends the Scalar API documentation integration from Chapter 1 (PR #236) to Chapters 2, 3, and 4 — covering both the Fitnet monolith and Fitnet.Contracts microservice where applicable.
Changes across all 5 affected projects (Ch2/Fitnet, Ch3/Fitnet, Ch3/Fitnet.Contracts, Ch4/Fitnet, Ch4/Fitnet.Contracts):
Directory.Packages.props— replaceSwashbuckle.AspNetCorewithScalar.AspNetCorev2.12.17; bumpMicrosoft.AspNetCore.OpenApito10.0.1; addFluentAssertionsv6.12.2 to Ch3 Fitnet test packagesDirectory.Build.props— add<InterceptorsNamespaces>$(InterceptorsNamespaces);Microsoft.AspNetCore.OpenApi.Generated</InterceptorsNamespaces>to enable the C# interceptors feature required by theMicrosoft.AspNetCore.OpenApisource generator (XML doc comment support).csproj— update package references; add explicitFluentAssertionsreference to Ch3 Reports integration testsProgram.cs— migrate to native OpenAPI + Scalar:launchSettings.json—launchUrl:swagger→docs/v1; remove IIS Express profileApiDocumentationExtensions.cs(Ch2 only) — root redirect updated from/swagger→/docs/v1; file renamed fromSwaggerDocumentationExtensions.cstoApiDocumentationExtensions.csto match the class nameInMemoryEventBusTests.cs(Ch2) — removed unnecessary null-forgiving operator (!) to resolveIDE0370build error📦 PR Includes
🚫 PR Does Not Include
💡 Additional Notes
API docs available at
/docs/v1in development mode. Consistent with the Chapter 1 implementation.The
Microsoft.AspNetCore.OpenApisource generator (introduced in .NET 10) emits C# interceptor code to support XML doc comments in OpenAPI specs. This requires explicitly opting in viaInterceptorsNamespacesin each chapter'sDirectory.Build.props; without it the build fails withCS9137.FluentAssertionswas referenced in Ch3 Reports integration tests'GlobalUsings.csbut was not declared as an explicit package reference. Added the package declaration (v6.12.2, matching Ch4) to resolve theCS0246build error.InMemoryEventBusTests.csused a null-forgiving operator (!) on a non-nullableIEventBusreturn value, which was flagged asIDE0370(unnecessary suppression) and treated as an error due toTreatWarningsAsErrors=trueandEnforceCodeStyleInBuild=trueinDirectory.Build.props. The suppression has been removed.⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.