Skip to content

7.2.1

Choose a tag to compare

@avgalex avgalex released this 13 Jul 11:12
· 5 commits to master since this release
8b41798

Fixed — aliased header parameters lost their FluentValidation rules

Reported in #230 by @jgarciadelanoceda.

With the document-filter pipeline enabled (UseDocumentFilter = true), constraints were not applied to aliased operation parameters:

public sealed class HelloRequest
{
    [FromQuery]
    public string? Name { get; set; }

    [FromHeader(Name = "X-Correlation-Id")]   // <- rules were silently dropped
    public string? XCorrelationId { get; set; }
}

Root cause: the document filter resolved the schema property key for the alias ("X-Correlation-Id"XCorrelationId) but used it only for required-marking, while the constraint copy still looked the property up by the raw alias — and never found it. The default operation-filter pipeline handled this correctly, so the two pipelines disagreed. The constraint copy now uses the resolved key and additionally falls back to the INameResolver for renames beyond separators (e.g. [JsonPropertyName]) — full parity with the operation filter.

Fixed — a dot in a header name dropped its rules (all pipelines)

A dot is legal in an HTTP header name, but [FromHeader(Name = "X.Trace.Id")] was mistaken for a flattened nested [FromQuery] dot-path (#209/#211): the name was truncated to the last segment (Id), matched no property, and the rules disappeared. Header-bound parameters are now exempt from the dot-path logic in all three parameter pipelines — FluentValidationOperationFilter, FluentValidationDocumentFilter and the ASP.NET Core FluentValidationOperationTransformer. This one affected the default pipeline too, not just the document filter. NSwag is unaffected (it has no dot-path parameter logic).

Fixed — case-sensitive parameter lookup in the document filter

The document filter matched document parameters to their ApiExplorer descriptions case-sensitively, so options such as DescribeAllParametersInCamelCase made it skip both required-marking and the constraint copy. The lookup is now case-insensitive, matching the operation filter.

Compatibility

Patch release — no public API changes. The constraint-copy fallback in the ASP.NET Core transformer was also aligned with the other two pipelines, so all three now resolve property names identically.


Full changelog: https://github.com/micro-elements/MicroElements.Swashbuckle.FluentValidation/blob/master/CHANGELOG.md