Conversation
…on (Issue #200) The AspNetCore.OpenApi package only had IOpenApiSchemaTransformer which processes component schemas. Query parameters with [AsParameters] are expanded inline and were never processed. Add IOpenApiOperationTransformer that applies FluentValidation rules to operation parameters, matching the behavior of Swashbuckle's FluentValidationOperationFilter. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
FluentValidationSchemaTransformer skipped all property-level schemas (JsonPropertyInfo != null), but for nested object types this was the only call — the type-level call never happened. Now property-level schemas for complex types are processed using the property type. Added regression tests for: top-level schemas, parent DTOs with nested objects, $ref preservation, enum properties, and query parameter schema cleanup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@claude review this PR |
|
Claude finished @avgalex's task in 2m 38s —— View job PR Review: Add operation transformer for query parameter validation (Issue #200)
Overall this is a well-structured solution to a real problem. The approach is correct and the test coverage is good. Below are observations ranging from bugs to minor improvements. Unused imports
using System.Text.Json; // unused
using System.Text.Json.Serialization.Metadata; // unusedPerformance: repeated work per parameterIn
For a container with N properties, all N parameters resolve to the same // Group parameters by their resolved container type, build schema once per type
var grouped = operation.Parameters
.Select(p => (Parameter: p, ContainerType: ResolveType(p, context)))
.Where(x => x.ContainerType != null)
.GroupBy(x => x.ContainerType!);
foreach (var group in grouped)
{
var schema = BuildSchemaForType(group.Key!);
var validator = _validatorRegistry.GetValidator(group.Key!);
// apply to each parameter in the group
}
|
- Remove unused imports (System.Text.Json, System.Text.Json.Serialization.Metadata) - Group parameters by container type to avoid redundant validator lookups and schema builds - Fix ResolveContainerType for nested dot-paths (use leaf name for property lookup) - Remove redundant ToLowerCamelCase property lookup (rely on NameResolver output) - Add MinItems/MaxItems to CopyValidationProperties Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@claude review this PR |
|
Claude finished @avgalex's task in 1m 54s —— View job PR Review: Add operation transformer for query parameter validation (Issue #200)
This PR is well-structured and addresses a real gap in the ASP.NET Core OpenAPI integration. The previous review comments have largely been addressed. Below is a focused review of what remains and what looks good. Addressed since the previous reviewThese concerns from the prior Claude review have been resolved:
Remaining issues1.
|
…maType - Fix ResolveContainerType to walk nested path segments for dot-path params - Add TODO comment for SetSchemaType DateTime/enum coverage - Rename misleading dot-path test to DirectAsParameters - Remove unsupported nested [AsParameters] endpoint (minimal API limitation) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Claude finished @avgalex's task in 1m 35s —— View job Review: Commit
|
| Change | Assessment |
|---|---|
SetSchemaType TODO |
✅ Addresses the review feedback cleanly |
| Test rename | ✅ Name now accurately reflects the scenario |
ResolveContainerType path-walking |
✅ Correct algorithm; segments.Length > 1 is unreachable but harmless — worth a comment |
[FromQuery] on TestNestedQueryParameters |
Nothing here is a blocker. The commit is a net improvement. Addressing the TestNestedQueryParameters dead code is the only thing worth a follow-up before merging.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Claude finished @avgalex's task in 38s —— View job Review: Commit
|
| Issue | Status |
|---|---|
| Unused imports | ✅ Fixed in earlier commit |
| Performance grouping | ✅ Fixed in earlier commit |
ResolveContainerType dot-path leaf name |
✅ Fixed in earlier commit |
Double ToLowerCamelCase lookup |
✅ Fixed in earlier commit |
MinItems/MaxItems/Format in CopyValidationProperties |
✅ Fixed in earlier commit |
SetSchemaType DateTime/enum coverage |
✅ TODO comment added |
| Misleading test name | ✅ Renamed to DirectAsParameters_ShouldHaveValidationConstraints |
TestNestedQueryParameters dead code with [FromQuery] |
✅ Removed in this commit |
| Unreachable branch undocumented | ✅ Comment added in this commit |
The PR is clean and ready to merge. The two remaining minor items (MultipleOf/UniqueItems omission and the nullable-but-required constructor parameter) are inherited from existing code and are reasonable to track as separate follow-ups.
Summary
[AsParameters]were not getting validation constraints inMicroElements.AspNetCore.OpenApi.FluentValidationIOpenApiSchemaTransformerwas implemented (processes component schemas), but query parameters are expanded inline and needIOpenApiOperationTransformerFluentValidationOperationTransformerapplies FluentValidation rules to operation parameters, matching the behavior of Swashbuckle'sFluentValidationOperationFilter[AsParameters]container type resolution with fallback via reflectionNote: Nested DTO validation in request bodies is a separate known limitation of the schema transformer, tracked separately.
Test plan
QueryParameters_WithAsParameters_ShouldHaveValidationConstraintstest🤖 Generated with Claude Code