Add MicroElements.AspNetCore.OpenApi.FluentValidation package (Issue #149)#189
Add MicroElements.AspNetCore.OpenApi.FluentValidation package (Issue #149)#189
Conversation
…149) New package integrating FluentValidation with Microsoft.AspNetCore.OpenApi (IOpenApiSchemaTransformer) for .NET 9 and .NET 10, without Swashbuckle dependency. - Implement FluentValidationSchemaTransformer (IOpenApiSchemaTransformer) - Support all rule types: Required, NotEmpty, Length, Pattern, Email, Comparison, Between - Handle AllOf/OneOf/AnyOf sub-schemas for polymorphic models - .NET 10: full nested validator support via GetOrCreateSchemaAsync - .NET 9: limited nested validator support (fallback to empty schema) - Add sample project SampleAspNetCoreOpenApi - Add ADR-001 documenting architectural decision - Bump version to 7.1.0-beta.1 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@claude review this PR |
|
Claude finished @avgalex's task in 3m 40s —— View job PR Review: Add
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix potential NullRef on assembly.FullName (null-conditional check) - Cache GetByFullName results in static ConcurrentDictionary (avoid per-request AppDomain scan) - Remove dead code ConfigureJsonOptionsForAspNetCore method - Add logger to AspNetCoreSchemaProvider for exception logging in catch block - Change exact version pinning to version ranges in .csproj Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@claude review Fix CI review findings for AspNetCore.OpenApi package |
|
Claude finished @avgalex's task in 1m 40s —— View job Review: CI Findings Fixes for
|
…kage - Finding 5: Add comment explaining TryAdd guard on bare JsonSerializerOptions - Finding 6: Add <remarks> to ProcessAllSchemas noting one-level-deep traversal - Finding 9: Add namespace preservation comment to copied compatibility files Co-Authored-By: @claude
|
@claude review Fix remaining CI review findings (5, 6, 9) for AspNetCore.OpenApi package |
|
Claude finished @avgalex's task in 50s —— View job Review: Fix Remaining CI Findings (5, 6, 9) for AspNetCore.OpenApi
All three remaining findings have been addressed. The changes are minimal and correct. Fixed — Verified ✓Finding 5 — A three-line comment was added above the // TryAdd ensures we only register a bare JsonSerializerOptions fallback when the host
// hasn't already registered one (e.g. via AddControllers or AddJsonOptions).
// This keeps the library non-intrusive while still providing a default for minimal APIs.The comment accurately describes the intent and the Finding 6 — Shallow An XML doc comment with a The remarks are accurate and clearly signal the known limitation and when an extension would be needed. Finding closed. Finding 9 — Inconsistent namespaces on copied files Both This precisely matches the suggested wording from the original review and correctly explains both the copy origin and the Phase 2 plan. Finding closed. Outstanding ItemsFinding 10 — No dedicated tests remains unaddressed, as it was from the previous review. This is the one item worth tracking. Recommend opening a follow-up issue to add automated tests for VerdictAll documentation/comment-level findings (5, 6, 9) are correctly resolved. The PR is ready to merge modulo the tracked follow-up for tests (Finding 10). The core implementation, DI registration, and critical bug fixes are all in good shape. |
Summary
MicroElements.AspNetCore.OpenApi.FluentValidationintegrating FluentValidation with Microsoft.AspNetCore.OpenApi (IOpenApiSchemaTransformer)New files
src/MicroElements.AspNetCore.OpenApi.FluentValidation/— new package (22 files)samples/SampleAspNetCoreOpenApi/— sample Minimal API projectdocs/adr/ADR-001-aspnetcore-openapi-support.md— architecture decision recordUser-facing API
```csharp
// Register services
services.AddFluentValidationRulesToOpenApi();
// Add transformer to OpenApi
services.AddOpenApi(options => options.AddFluentValidationRules());
```
Migration from Swashbuckle
```diff
```
Test plan
Related to #149
🤖 Generated with Claude Code