7.2.0
Added — the document-filter pipeline is now a supported opt-in (UseDocumentFilter)
services.AddFluentValidationRulesToSwagger(
configureRegistration: options => options.UseDocumentFilter = true);The document filter processes the whole OpenAPI document at once — component schemas, operation parameters and request bodies — and performs the unused-query-schema cleanup once at the end. Because there is no per-operation state, the shared-DTO bug class (#223, #226) cannot occur in this pipeline, on any target framework — including net8.0/net9.0, where the 7.1.11 fix could not fully apply (the ReplaceSchemaId healing API only exists in Swashbuckle 10.1.0+).
Full parity with the default pipeline
Previously the filter was experimental with significant gaps. Now it matches the default schema + operation filter pipeline:
- Required-marking with the whole-dot-path check (#209)
- Request bodies and
encoding.contentTypefor[FromForm]uploads (#216) - Multiple validators per type,
allOf/oneOf/anyOftraversal $refpreservation for properties untouched by rules (#198, net10.0)- Every operation of a multi-verb path is processed (previously only the first)
- On net10.0 the cleanup also clears Swashbuckle's internal reserved-ids for processed container types, so custom document filters running afterwards can regenerate them
The #209 and #216 logic is shared between both pipelines via internal components, so they cannot drift apart.
Robustness
A throwing validator no longer fails the whole document generation; the filter falls back to ServiceProviderValidatorRegistry like the sibling filters and honors an injected IFluentValidationRuleProvider (new optional constructor parameter, appended last — source-compatible). Behavior note: constructing the filter directly with neither validatorRegistry nor serviceProvider now throws ArgumentNullException instead of silently applying no rules; the DI path is unaffected.
Compatibility
- The default pipeline is unchanged —
UseDocumentFilterdefaults tofalse. A future major version may switch the default. ExperimentalUseDocumentFilterstill works as an[Obsolete]alias forwarding toUseDocumentFilter.samples/MinimalApinow runs on the document-filter pipeline; the README documents the option and its caveats.
Full changelog: https://github.com/micro-elements/MicroElements.Swashbuckle.FluentValidation/blob/master/CHANGELOG.md