- Fixed:
MicroElements.AspNetCore.OpenApi.FluentValidationdid not apply FluentValidation rules to a[FromForm]DTO bound by an MVC controller action (Issue #232, follow-up to the Swashbuckle-only #170 fix)- Root cause: MVC
ApiExplorerflattens a controller's[FromForm]complex parameter into one form field per property, soMicrosoft.AspNetCore.OpenApibuilds the request body as an inline schema from those descriptions and never asks for the DTO'sJsonTypeInfo—FluentValidationSchemaTransformertherefore never saw the type. Minimal API form bodies are not flattened and were never affected - Fix:
FluentValidationOperationTransformernow applies the DTO's rules to the inline form schema for bothmultipart/form-dataandapplication/x-www-form-urlencoded. The flattening is detected viaModelMetadata.ContainerTypeon the form-bound parameter descriptions, so a minimal API body — which the schema transformer already owns — is never touched twice - Property keys are taken verbatim from the schema, because a flattened form field is named after the model binder (
Name, notname); the validator-side match stays name-insensitive - An action binding more than one form parameter composes its body as an
allOfof one property bag per parameter; every bag is now constrained, and each bag is paired with the parameter that owns its fields — including the parameters the action binds directly (a loose scalar, array orIFormFile), which get a bag of their own but no rules. Without that pairing a DTO could be pulled into a foreign bag by a single coinciding field name and lose the constraints on its own bag encoding.contentType(Issue #216) is now also emitted when the file part sits inside such anallOfbag- Dotted keys (
Inner.City, ApiExplorer's binding path for a nested complex property) are skipped: the name matcher ignores separators, so such a key would otherwise inherit the rules of an unrelated root property namedInnerCity. Nested form fields remain unsupported, matching the Swashbuckle form path - Issue #216
encoding.contentTypeis unchanged for the shapes it already covered, and now also consults every validator in multi-validator mode (IsOneValidatorForType = false) instead of only the first - Known limitations on this path (unchanged by this fix): a renamed form field (
[FromForm(Name = "...")], or a property renamed by theINameResolver) gets no constraints, and on net10 a form part rendered as a$ref(IFormFile, enums) cannot receive property-level constraints - Thanks to @bux for the report
- Root cause: MVC
- Fixed: the document-filter pipeline (
UseDocumentFilter = true) did not apply FluentValidation constraints to aliased operation parameters such as[FromHeader(Name = "X-Correlation-Id")](Issue #230). The constraint copy now uses the resolved schema property key (kebab-case/camelCase/PascalCase aliases) and falls back to theINameResolverfor renames beyond separators (e.g.[JsonPropertyName]) — full parity with the operation filter - Fixed: a dot in a header name (
[FromHeader(Name = "X.Trace.Id")]— legal in HTTP) was treated as a nested[FromQuery]dot-path (#209/#211) and silently dropped the header's validation rules. Header-bound parameters are now exempt from the dot-path logic in all three parameter pipelines:FluentValidationOperationFilter,FluentValidationDocumentFilterand the ASP.NET CoreFluentValidationOperationTransformer. NSwag is unaffected (it has no dot-path parameter logic) - Fixed: the document filter matched document parameters to
ApiExplorerdescriptions case-sensitively, so options likeDescribeAllParametersInCamelCasemade it skip required-marking and constraint copying. The lookup is now case-insensitive, matching the operation filter - Thanks to @jgarciadelanoceda for the report and the repro
- Added: the document-filter pipeline is promoted from experimental to a supported opt-in (
RegistrationOptions.UseDocumentFilter, defaultfalse). The document filter processes the whole document at once and performs the unused-query-schema cleanup once at the end, so per-operation shared-DTO state issues (#223/#226) cannot occur in this pipeline — on all target frameworks, including net8.0/net9.0 where the 7.1.11 healing API is unavailable- Full functional parity with the default schema + operation filter pipeline: required-marking with the whole-dot-path check (#209), request bodies and
encoding.contentTypefor[FromForm](#216), multi-validator support,allOf/oneOf/anyOftraversal,$refpreservation for unmodified properties (#198, net10.0), and every operation of a multi-verb path is now processed (previously only the first) - The #209 and #216 logic is extracted into internal components shared by both pipelines, so they cannot drift apart
- Robustness: the filter no longer fails the whole document generation on a throwing validator (top-level try/catch), falls back to
ServiceProviderValidatorRegistrylike the sibling filters, honors an injectedIFluentValidationRuleProvider(new optional constructor parameter, appended last — source-compatible), and had its dead code, logging and nullability issues cleaned up. Behavior note: constructingFluentValidationDocumentFilterwith neithervalidatorRegistrynorserviceProvidernow throwsArgumentNullException(matching the sibling filters) instead of silently producing a filter that applies no rules; the DI registration path is unaffected - On net10.0 the cleanup also heals Swashbuckle's reserved-ids for processed container types (
SchemaRepository.ReplaceSchemaId), so custom document filters running afterwards can regenerate them ExperimentalUseDocumentFilterstill works as an[Obsolete]alias forwarding toUseDocumentFilter- The default pipeline is unchanged; a future major version may switch the default
samples/MinimalApinow runs on the document-filter pipeline; README documents the option and its caveats
- Full functional parity with the default schema + operation filter pipeline: required-marking with the whole-dot-path check (#209), request bodies and
- Fixed: a DTO shared between a flattened
[FromQuery]/[AsParameters]binding and a request body ([FromBody]/[FromForm]) in the same document could lose its FluentValidation rules, and the emitted document could contain a$refto a removed component (Issue #226). net10.0 target only- Root cause: the Issue #180 cleanup left the container type "reserved-but-removed" in Swashbuckle's
SchemaRepository(component removed, internal reserved-id kept). The 7.1.10 fix (#223) recovered the schema for reading constraint values, but a later[FromBody]/[FromForm]operation binding the same type made Swashbuckle emit a$refto a component that no longer exists (confirmed empirically), and rules applied on the recovered throwaway instance never reached the document - Fix (net10.0 / Swashbuckle 10.x): the Issue #180 cleanup now heals the repository state via
SchemaRepository.ReplaceSchemaId(public API since Swashbuckle 10.1.0) before removing a side-effect schema — the reservation is cleared together with the component, so the next operation binding the same type regenerates a full component and the rules reach the real document object.SwashbuckleSchemaProvidertracksType → schemaIdfor everyGetSchemaForTypecall (including the Issue #209 ancestor walk) to make the healing possible - net8.0/net9.0 keep the 7.1.10 behavior: they pin Swashbuckle 8.1.1 where
ReplaceSchemaIddoes not exist, and bumping the minimum would force the Microsoft.OpenApi 2.x breaking change on consumers. The throwaway recovery from #223 remains as a safety net on all targets - Thanks to @jgarciadelanoceda for suggesting the
ReplaceSchemaIdapproach
- Root cause: the Issue #180 cleanup left the container type "reserved-but-removed" in Swashbuckle's
- Fixed: the same
[FromQuery]/[AsParameters]DTO shared by more than one endpoint lost its FluentValidation rules on every endpoint after the first (Issue #223)FluentValidationOperationFilterruns once per operation. The Issue #180 cleanup removes the temporary container schema fromSchemaRepository.Schemas, but Swashbuckle keeps the type in its internal reserved-ids map, which the cleanup does not touch. For the 2nd+ endpoint,GetSchemaForType→GenerateSchemathen returns a bare$ref(noProperties) and the schema is no longer inSchemas, so the "has properties" guard was skipped and no rules were applied. Only reproduces with the defaultRemoveUnusedQuerySchemas = true- Fix: in
SwashbuckleSchemaProvider.GetSchemaForType, when the returned schema has no properties and the id is absent from the shared repository (the reserved-but-removed state), the concrete schema is recovered by generating it into a throwawaySchemaRepository. Fully isolated — it never mutates the shared repository or its reserved-id state — so the Issue #180 cleanup and all otherOperationFilterbehavior (required marking #209, nested[FromQuery]#211/#213, request bodies, #216) are preserved
- Fixed: numeric bounds from
short/byte/ushort/uint/ulong/sbyte-typed rules were silently dropped (Issue #222)IsNumericin the shared core (MicroElements.OpenApi.FluentValidation) only recognizedint/long/float/double/decimal/BigInteger, so aBetween/Comparisonrule whose bound was a small integer type (e.g.InclusiveBetween((short)1, (short)99)) matched but produced nominimum/maximum— even though the generator emits"type": "integer"for the property. This could not be worked around at the validator definition site because those rule overloads only accept bounds of the property's own type- Fix:
IsNumericnow recognizes all integer primitives (sbyte/byte/short/ushort/int/uint/long/ulong) in addition to the floating/decimal/BigIntegertypes;NumericToDecimalalready converted them all. One change in the shared core fixes all three providers (Swashbuckle, NSwag, and the nativeMicrosoft.AspNetCore.OpenApitransformer)
- Security (Issue #220): closed a transitive high-severity advisory in the published package.
Swashbuckle.AspNetCore.SwaggerGenon the net10.0 target was bumped10.0.0→10.2.1, which resolvesMicrosoft.OpenApito the patched2.7.5(was2.3.0). This clears GHSA-v5pm-xwqc-g5wc / CVE-2026-49451 (CWE-674 uncontrolled recursion — a circular$refschema could stack-overflow the OpenAPI reader). The net8.0/net9.0 targets use Swashbuckle 8.1.1 → Microsoft.OpenApi v1 and were never in the advisory range - Media type & file size validation for
IFormFileuploads (Issue #216): stable rollup of everything in7.1.8-beta.1and7.1.8-beta.2below (new File-level rules.FileContentType(),.MaxFileSize(),.MinFileSize(),.FileSizeBetween(); Swashbuckle / NSwag / Microsoft.AspNetCore.OpenApi emit multipartencoding.contentTypeand description annotations)
- All of
7.1.8-beta.1below, plus: Microsoft.AspNetCore.OpenApi now also emitsencoding.contentTypefor the file part (Issue #216) — theFluentValidationOperationTransformerwritesrequestBody.content["multipart/form-data"].encoding.<part>.contentTypeso UIs like Scalar/Swagger UI can show the accepted media types, not just the description. Works on net9.0 (inline form schema) and net10.0 (resolves the whole-body$refcomponent to find the part name)
- Added: media type (content type) and file size validation for
IFormFileuploads (Issue #216)- New File-level FluentValidation rules in
MicroElements.OpenApi.FluentValidation(namespaceMicroElements.OpenApi.FluentValidation.FileUpload):.FileContentType(params string[]),.MaxFileSize(long),.MinFileSize(long),.FileSizeBetween(long, long)onIRuleBuilder<T, IFormFile>. They both enforce validation at runtime and surface metadata for OpenAPI generation - Root cause: rules on nested
IFormFilemembers (RuleFor(x => x.File.Length)/RuleFor(x => x.File.ContentType)) are namedFile.Length/File.ContentTypeand never match the flat schema propertyFile, so they were silently dropped; andMust(...)is opaque so allowed content types could not be reflected. Use the new File-level rules instead - Swashbuckle: emits
requestBody.content["multipart/form-data"].encoding.<part>.contentType(comma-joined allowed types) and appends the allowed types and size limits to the file propertydescription. File size is never emitted asmaxLength(which counts characters, not bytes). Works on net8.0/net9.0 (Microsoft.OpenApi v1, OpenAPI 3.0) and net10.0 (Microsoft.OpenApi v2, OpenAPI 3.1) - NSwag: a new
FluentValidationOperationProcessor(IOperationProcessor) emits multipart encoding for file parts; the allowed types and size limits are also appended to the file partdescription. Register it alongside the schema processor:settings.OperationProcessors.Add(serviceProvider.GetService<FluentValidationOperationProcessor>()). Known NSwag limitation:OpenApiEncoding.EncodingTypeserializes asencodingTyperather than the OpenAPI-speccontentType(through at least NSwag 14.7.x), so thedescriptionis the guaranteed-visible carrier - Microsoft.AspNetCore.OpenApi: the allowed types and size limits are appended to the file property
description, and (since7.1.8-beta.2) the allowed types are also emitted asencoding.contentTypeon the multipart media type - Purely additive / opt-in: behavior only changes when the new rules are used; no existing document output changes
- File size has no standard OpenAPI/JSON-Schema byte keyword, so it is documented in the
description(annotation only; enforcement stays server-side via FluentValidation)
- New File-level FluentValidation rules in
- Fixed: The nested
[FromQuery]fixes (#209 + #211) now also apply to the nativeMicrosoft.AspNetCore.OpenApitransformer and the experimental Swashbuckle DocumentFilter (Issue #213)FluentValidationOperationTransformer(packageMicroElements.AspNetCore.OpenApi.FluentValidation) previously set a nested parameterrequiredfrom the leaf validator alone — ignoring both whether theSetValidator/ChildRuleschain reaches the leaf (#211) and whether every ancestor of the dot-path is required (#209). It now follows the same reachability + ancestor-required rules as the SwashbuckleOperationFilter- The experimental
FluentValidationDocumentFilterno longer copies value constraints onto a flattened nested parameter whose nested validation is not wired from the root validator (#211) GetMethodInfonow resolves the action method fromControllerActionDescriptor(MVC controllers), not only minimal-API endpoint metadata, so the dot-path root type can be resolved for controller actions- NSwag is unaffected (it has no
[FromQuery]parameter flattening)
- Fixed: A validator for a nested type bound via
[FromQuery]was reflected in the OpenAPI document even when it was not wired into the root validator viaSetValidator/ChildRules(Issue #211)FluentValidationOperationFilterresolved the leaf container's validator directly from the registry (byModelMetadata.ContainerType), so a nestedNotEmpty()marked the flattened parameter (e.g.RequiredSubType.SubProperty) asrequiredeven though FluentValidation never validates an unwired child object — the OpenAPI doc claimedrequired, but the API accepted requests without it- Fix: for a flattened nested parameter, nested rules are now applied only when the
SetValidator/ChildRuleschain from the action's root[FromQuery]validator actually reaches the leaf container; otherwise the parameter is left unconstrained, matching runtime behavior - When the root container type cannot be resolved, prior behavior is preserved (no regression for existing nested-parameter scenarios)
- Behavioral change: when no validator is registered for the root
[FromQuery]type (only a leaf/child validator is registered), a flattened nested parameter is now left unconstrained — matching runtime, where no validation runs without a root validator
- Fixed: A required leaf property inside an optional nested type bound via
[FromQuery]was wrongly marked as a required parameter (Issue #209)- The 7.1.1 fix (Issue #162) made nested
[FromQuery]validation match the leaf property name, butFluentValidationOperationFilterthen setrequiredbased solely on the leaf type, ignoring whether the ancestor segment of the dot-path was optional - Because two nested properties of the same leaf type share one schema/validator (e.g.
OptionalSubType.SubPropertyandRequiredSubType.SubProperty), aNotEmpty()on the leaf marked both flattened parameters as required - Fix: a flattened nested parameter is now marked
requiredonly when every ancestor segment of the dot-path is required — resolved from the action's root[FromQuery]type, combining the native schemarequired(e.g. the C#requiredmodifier) with FluentValidationNotNull/NotEmptyrules - Value constraints (e.g.
minLength) still apply to an optional nested parameter when it is provided - When the root container type cannot be resolved, prior behavior is preserved (no regression for existing nested-parameter scenarios)
- The 7.1.1 fix (Issue #162) made nested
- Fixed:
$refstill replaced with an inline copy (and the child component left orphaned) when nested object constraints come fromChildRulesor an inline child validator (Issue #198, comment 4601720562)- The 7.1.3 fix restored unmodified
$refs, but when the nested type had no standalone validator its component schema gained itsRequiredonly after the parent's inline snapshot, so the staleRequireddiverged and defeated the restore check — leaving an inline copy and an orphaned component - Fix: the
Requiredcomparison inHasValidationConstraintChangesis now directional — restoration is only blocked when the inline copy carries a required entry the component lacks SetValidator(with a standalone child validator) was already correct;BigInteger/enum per-model constraints (Issues #146/#176) continue to work
- The 7.1.3 fix restored unmodified
- Added:
ConditionalRulesModeoption to control how.When()/.Unless()conditional rules are handled during schema generation (Issue #203)Exclude(default): conditional rules are excluded from the schema (backward-compatible, existing behavior)Include: conditional rules are included in the schema (useful when.When()is a null-guard and constraints should still appear)IncludeWithWarning: same asIncludebut logs a warning for each conditional rule included- Usage:
options.ConditionalRules = ConditionalRulesMode.Include;
- Fixed: Multiple
.Matches()rules on one property displayed incorrectly — only the first pattern shown, property duplicated (Issue #204)- Multiple patterns were placed into separate
allOfsubschemas, which Swagger UI/Redoc/Scalar collapse, keeping only the firstpattern - Now multiple
.Matches()rules are combined into a singlepatternvia lookahead assertions (e.g.(?=[\s\S]*(?:[a-z]))(?=[\s\S]*(?:[A-Z]))), preserving.Matches()semantics and rendering correctly - Applied to all providers: Swashbuckle,
MicroElements.AspNetCore.OpenApi.FluentValidation, and NSwag (NSwag previously kept only the last pattern) - Changed:
SchemaGenerationOptions.UseAllOfForMultipleRulesdefaulttrue→false; set it totrueto keep the legacyallOfrepresentation
- Multiple patterns were placed into separate
- Added:
FluentValidationOperationTransformer(IOpenApiOperationTransformer) forMicroElements.AspNetCore.OpenApi.FluentValidation(Issue #200)- Query parameters with
[AsParameters]now receive validation constraints (min/max, required, pattern, etc.) - Supports container type resolution with fallback via reflection for
[AsParameters] - Copies validation constraints from schema properties to parameter schemas
- Registered automatically via
AddFluentValidationRules()
- Query parameters with
- Fixed: Nested DTOs in request body not receiving validation constraints (Issue #200)
FluentValidationSchemaTransformerskipped all property-level schemas, but for nested object types this was the only transformer call- Now processes property-level schemas for complex types using the property type's validator
- Fixed:
$refreplaced with inline schema copy when usingSetValidatorwith nested object types (Issue #198)ResolveRefProperty(introduced in 7.1.2 for BigInteger isolation) replaced all$refproperties with copies, destroying reference structure in the OpenAPI document- Fix: snapshot
$refproperties before rule application, restore them afterwards if no validation constraints were added by rules - BigInteger per-model constraints (Issue #146) continue to work correctly
- Added:
BigIntegersupport for min/max validation constraints in OpenAPI schema generation (Issue #146)IsNumeric()andNumericToDecimal()now handleBigIntegervaluesBigIntegerproperties with GreaterThan, LessThan, InclusiveBetween, ExclusiveBetween rules produce correctminimum/maximumin Swagger- NSwag provider updated with the same
BigIntegersupport - Out-of-range
BigIntegervalues (exceedingdecimalrange) are handled gracefully via existing try/catch
- Fixed: Shared schema mutation when multiple models reference the same
BigIntegertype with different constraints (net10.0)ResolveRefPropertycreates an isolated shallow copy before applying rule mutations- Prevents
$ref-based schema corruption across models inSchemaRepository
- Fixed: Replaced deprecated
PackageLicenseUrlwithPackageLicenseExpression(Issue #144) - Fixed: Replaced deprecated
PackageIconUrlwith embeddedPackageIcon
- Fixed: Nested object validation not applied for
[FromQuery]parameters (Issue #162)- When Swashbuckle decomposes
[FromQuery]models with nested objects into flat parameters (e.g.,operation.op), the full dot-path name was used for schema property matching instead of the leaf name (op) EqualsIgnoreAll("operation.op", "op")compared"OPERATIONOP"vs"OP"and failed to match- Strip dot-path prefix using
LastIndexOf('.')in bothFluentValidationOperationFilterandFluentValidationDocumentFilter - Supports arbitrarily deep nesting (e.g.,
a.b.c→c)
- When Swashbuckle decomposes
- Added:
SetNotNullableIfMinimumGreaterThenZerooption to separately control nullable behavior for numeric Minimum constraints (Issue #154, ported from vchirikov fork PR #2)- Distinct from existing
SetNotNullableIfMinLengthGreaterThenZero(for string MinLength) - Default:
false(backward compatible)
- Distinct from existing
- Fixed:
SetNotNullableIfMinLengthGreaterThenZerooption now works in NSwag provider (Issue #154)NSwagFluentValidationRuleProvidernow acceptsIOptions<SchemaGenerationOptions>- Rules NotEmpty, Length, Comparison, Between respect both nullable options
- Feature parity across Swashbuckle, AspNetCore.OpenApi, and NSwag providers
- Improved: Comparison/Between rules now use
SetNotNullableIfMinimumGreaterThenZero()which checks actual Minimum value instead of unconditionally setting not-nullable
- Added: New package
MicroElements.AspNetCore.OpenApi.FluentValidationfor Microsoft.AspNetCore.OpenApi support (Issue #149)- Implements
IOpenApiSchemaTransformerfor .NET 9 and .NET 10 - Supports all FluentValidation rules: Required, NotEmpty, Length, Pattern, Email, Comparison, Between
- Handles AllOf/OneOf/AnyOf sub-schemas for polymorphic models
- No dependency on Swashbuckle
- User-facing API:
services.AddFluentValidationRulesToOpenApi()+options.AddFluentValidationRules() - .NET 10: full nested validator support via
GetOrCreateSchemaAsync - .NET 9: limited nested validator support (fallback to empty schema)
- Implements
- Fixed: AspNetCore.OpenApi.FluentValidation support for .NET 10 (Issue #149, PR #192)
- Added: Sample project
SampleAspNetCoreOpenApidemonstrating Microsoft.AspNetCore.OpenApi integration - Added: ADR-001 documenting the architectural decision for AspNetCore.OpenApi support
- Added: New package
MicroElements.AspNetCore.OpenApi.FluentValidationfor Microsoft.AspNetCore.OpenApi support (Issue #149)- Implements
IOpenApiSchemaTransformerfor .NET 9 and .NET 10 - Supports all FluentValidation rules: Required, NotEmpty, Length, Pattern, Email, Comparison, Between
- Handles AllOf/OneOf/AnyOf sub-schemas for polymorphic models
- No dependency on Swashbuckle
- User-facing API:
services.AddFluentValidationRulesToOpenApi()+options.AddFluentValidationRules() - .NET 10: full nested validator support via
GetOrCreateSchemaAsync - .NET 9: limited nested validator support (fallback to empty schema)
- Implements
- Added: Sample project
SampleAspNetCoreOpenApidemonstrating Microsoft.AspNetCore.OpenApi integration - Added: ADR-001 documenting the architectural decision for AspNetCore.OpenApi support
- Fixed:
[AsParameters]validation rules not applied on .NET 8 Minimal APIs (Issue #180)- On .NET 8,
ModelMetadata.ContainerTypeis null for[AsParameters]decomposed parameters - Added
AsParametersHelperfallback that resolves the container type via[AsParameters]reflection onMethodInfo - Applied fallback in both
FluentValidationOperationFilterandFluentValidationDocumentFilter - Zero regression on .NET 9/10 where
ContainerTypeis already populated
- On .NET 8,
- Added:
RemoveUnusedQuerySchemasoption (default:true) to control cleanup of container type schemas for[FromQuery]/[AsParameters]types (Issue #180)
- Fixed:
[AsParameters]types in minimal API and[FromQuery]container types create unused schemas incomponents/schemas(Issue #180) - Added: Support for keyed DI services (Issue #165)
- Validators registered via
AddKeyedScoped,AddKeyedTransient,AddKeyedSingletonare now discovered automatically
- Validators registered via
- Removed: Deprecated
FluentValidation.AspNetCorepackage reference (Issue #164)- Replaced with
FluentValidation.DependencyInjectionExtensions12.0.0
- Replaced with
- Fixed: NullReferenceException when models contain nested object properties (Issue #176 extended)
- Handle
OpenApiSchemaReferencefor nested class properties inOpenApiRuleContext - Add safe
TryGetValuecheck inNSwagRuleContext
- Handle
- Fixed: InvalidCastException when models contain enum properties (Issue #176)
- In Microsoft.OpenApi 2.x, enum properties are represented as
OpenApiSchemaReferenceinstead ofOpenApiSchema - Filter out schema references in
GetProperties()method to avoid cast exception
- In Microsoft.OpenApi 2.x, enum properties are represented as
- Fixed: FluentValidation rules not applied to
[FromForm]parameters (Issue #170)- Added
RequestBodyprocessing inFluentValidationOperationFilterformultipart/form-dataandapplication/x-www-form-urlencodedcontent types
- Added
- Added support for .NET 8 and .NET 9 to MicroElements.Swashbuckle.FluentValidation.AspNetCore
- Dropped support for .NET 6.0
- Updated NJsonSchema to version 10.6.10
- see changelog for betas
- Added:
IFluentValidationRuleProvidercan be replaced with DI - Added:
ISchemaGenerationOptions.ValidatorSearchIsOneValidatorForType: bool; Valuetrue: Gets only one validator (default),false: Gets all suitable validators (new)SearchBaseTypeValidators: allows to search base type validators
- Fixed: Stack Overflow Exception when using recursive validator type (PR#122 by @rachelpetitto)
- Deleted:
FluentValidationRulesRegistrator - Deleted:
SwaggerGenOptionsfrom filters - Many minor code cleanups
- Codebase unified with NSwag
- Added: MicroElements.NSwag.FluentValidation package. Early version
- Change:
INameResolverremoved from FluentValidationRules ctor. Set it fromSchemaGenerationOptions - Change:
ISchemaGenerationSettingsmerged toISchemaGenerationOptions - Change:
IValidatorRegistryand it's implementations moved to MicroElements.OpenApi.FluentValidation namespace and package - Change:
IValidatorRegistrycan return more than one validator with methodGetValidators - Added:
ValidatorSearchstrategy OneForType, ManyForType - Added:
ISchemaGenerationOptions.ValidatorFilter,ISchemaGenerationOptions.RuleFilter,ISchemaGenerationOptions.RuleComponentFilter- Default Rule and RuleComponent filters checks that rule or component has no conditions.
- Default ValidatorFilter checks that validator CanValidateInstancesOfType
- Change:
UseAllOfForMultipleRulestypo fix
- Abstracted common logic for NSwag
- Moved from
IValidationFactory(obsolete in FV 11.1.0) toIValidationRegistry - Supported FluentValidation 11
AddFluentValidationAutoValidation - Removed
HttpContextServiceProviderValidatorFactory - Experimental
DocumentFilter
- Change: ILengthValidator support for arrays. Sets MinItems, MaxItems (PR#108 by biggik)
- Supported FluentValidation 11
- Sets min compatibility to Swashbuckle.AspNetCore 6.3.0. (PR#102 by guimabdo)
- Adding additional fields (Enum, Description) for overridden schema in FluentValidationOperationFilter. (PR#95 by kritsda-jiwatrakan)
- Fixed Issue #94: Rule with overridden property name unexpectedly applied to property
- Fixed case with many rules for one property. Issue #92
- Change: NotEmpty rule sets minItems for arrays instead minLength.
- Use new registration method AddFluentValidationRulesToSwagger instead of AddFluentValidationRules to allow all feature set
- AddFluentValidationRules become obsolete
- Added ability to set ServiceLifetime in AddFluentValidationRulesToSwagger, default value: Scoped. Fixes #83
- Turned off test rule BeforeAll. Fixes #87
- More detailed warnings in FluentValidationRulesScopeAdapter
- Added detailed error on getting absent property by name
- FluentValidation updated to 10.0.0
- Swashbuckle.AspNetCore updated to 6.0.0
- RuleContext: Obsolete SchemaFilterContext replaced with ReflectionContext (removed dependency on Swashbuckle)
- Dependency Swashbuckle.AspNetCore changed to Swashbuckle.AspNetCore.SwaggerGen which is UI independent (PR#82 by buvinghausen)
- Added INameResolver to resolve names. Issue #80
- Added AddFluentValidationRulesToSwagger extensions to simplify registration
- FluentValidationSwaggerGenOptions renamed to SchemaGenerationOptions, IsAllOffSupported renamed to UseAllOffForMultipleRules
- Fixed #79: Adding a simple Length validation to a string field should not make the field non-nullable
- Fixed #76: SetValidator is applying FluentValidation rules to parent object property with same name
- Swashbuckle.AspNetCore version supports up to 7 (PR#75 by fabich)
- RuleForEach supported. Issue #66
- SetValidator supported. Issue #68
- Multiple match rules supported with allOf. Issue #69
- Fixed #67: Absence of MinimumLength should not override nullable. (PR#67 by bcronje)
- Fixed #70: Nullability for numerics if MinLength is greater then zero
- Nullable annotations added
- FluentValidation updated to [9.0.0]
- Swashbuckle.AspNetCore updated to [5.5.1]
- Changed getting included validator (FluentValidation internal API changed)
- New EmailValidator rule compatible with FluentValidation AspNetCoreCompatibleEmailValidator
- FluentValidation fix version to [8.3.0, 9)
- Swashbuckle.AspNetCore fix version to [5.2.0, 6)
- Base type for numeric switched to decimal to match type change in OpenApi. Fixes floating numbers with nines after period.
- More smart MinLength, MaxLength, Minimum, Maximum that allows to combine rules without override values.
- More strict limits will be used for min and max values that was set more then once in other rules
- Mark required properties as not nullable (PR#58 by @manne) Fixes: #55, #57
- Swashbuckle.AspNetCore updated to version >= 5.2.0
- Fixed: #53 (Missing method exception when using Swashbuckle > 5.0.0)
-
Supports Swashbuckle 5, net core 3 and brand new System.Text.Json
-
Swashbuckle.AspNetCore updated to version >= 5.0.0 (new Microsoft.OpenApi)
-
FluentValidation updated to version >= 8.3
-
FluentValidation property rules of type CollectionValidationRules (RuleForEach()) are no longer exposed #49.
-
New IgnoreAllStringComparer was invented to solve problem with different property name formatting: camelCase, PascalCase, snake_case, kebab-case
-
Added NewtonsoftJsonNamingPolicy example to override property name formatting in new System.Text.Json according Newtonsoft.Json.Serialization.NamingStrategy (see: SampleWebApi)
-
Fixed invalid documentation on validation rules containing a condition #38
-
Fixed: #37 (FluentValidationOperationFilter now uses swachbuckle interface to determine json settings)
- Swashbuckle.AspNetCore updated to version >= 5.0.0
- FluentValidation property rules of type CollectionValidationRules (RuleForEach()) are no longer exposed #49.
- Swashbuckle.AspNetCore updated to version >= 5.0.0-rc4 (breaking changes: IApiModelResolver was removed from API)
- New IgnoreAllStringComparer was invented to solve problem with different property name formatting: camelCase, PascalCase, snake_case, kebab-case
- Added NewtonsoftJsonNamingPolicy example to override property name formatting in new System.Text.Json according Newtonsoft.Json.Serialization.NamingStrategy (see: SampleWebApi)
- Updated FluentValidation to version >= 8.3
- Fixed invalid documentation on validation rules containing a condition #38
- Swashbuckle.AspNetCore updated to version >= 5.0.0-rc4
- Fixed: #37 (FluentValidationOperationFilter now uses swachbuckle interface to determine json settings)
- Swashbuckle.AspNetCore updated to version >= 5.0.0-rc3 (PR#35 by @vova-lantsov-dev)
- Reintegrated features from 2.2.0
- Swashbuckle.AspNetCore updated to version >= 5.0.0-rc2 (many breaking changes)
- Swashbuckle.AspNetCore updated to version >= 5.0.0-beta
- Added HttpContextServiceProviderValidatorFactory to resolve scoped Dependency Injection (PR#34) by @WarpSpideR
- Fixed MinLength rewrite by MaxLength validator #32
- Changes: Allow to use SwaggerGenOptions.CustomSchemaIds (PR#31) by @mkjeff
- Fixed: #24: NullReferenceException on apply rule for operations.
- Changes: Added more debug logging.
- Swashbuckle.AspNetCore updated and restricted to version [4.0.0, 5.0.0)
- Breaking Changes: FluentValidation updated to 8.1.3 to support when/unless (PR#27) by @emilssonn
- Changes: Running through included validators recursively to add the entire tree (PR#29) by @runebaekkelund
- Changes: Numeric types includes decimal
- Changes: Schema Minimum and Maximum now supports doubles (was only int)
- WARNING: ScopedSwaggerMiddleware doesn't work as expected because Swashbuckle.AspNetCore changed a lot. Looking for workaround.
- Added: Numeric types includes decimal
- Swashbuckle.AspNetCore version locked to versions [1.1.0-3.0.0] because version 4.0.0 has breaking changes. Next version will be 2.0.0 according semver.
- Added ScopedSwaggerMiddleware to resolve error "Cannot resolve 'MyValidator' from root provider because it requires scoped service 'TDependency'"
- Added support for Include
- Bugfixes
- Updated samples and documentation
- Build scripts migrated to MicroElements.Devops
- Build: added SourceLink
- Fixed: #13: Fixed warning with null schema.Properties
- Fixed: #12: Fixed NullReferenceException, if schema.Properties is null
- New feature: FluentValidation rules for get operation parameters binded from models with validators. Adds swagger validation for parameters: Required, MinLength, MaxLength, Minimum, Maximum, Pattern (DataAnnotation works only with [Required]).
- Fixed: #10: Now member search is IgnoreCase
- Fixed: Possible double Required
- Improved stability and diagnostics
- Added GetValidator error handling, ApplyRule error handling
- Added ability to work without provided FluentValidation (does not break anything)
- Added ability to use Microsoft.Extensions.Logging.Abstractions (no additional dependencies)
- Added logging in error points (logs as warnings)
- Fixed: #6: Removed empty required array from swagger schema
- Supported float and double values for IComparisonValidator and IBetweenValidator
- Refactored to easy add new rules
- Added ability to add rules through DI Supported validators:
- INotNullValidator (NotNull)
- INotEmptyValidator (NotEmpty)
- ILengthValidator (Length, MinimumLength, MaximumLength, ExactLength)
- IRegularExpressionValidator (Email, Matches)
- IComparisonValidator (GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual)
- IBetweenValidator (InclusiveBetween, ExclusiveBetween)
- FluentValidationRulesRegistrator moved to main swagger namespace
- Added FluentValidationRulesRegistrator
- Added FluentValidationRules.
Full release notes can be found at https://github.com/micro-elements/MicroElements.Swashbuckle.FluentValidation/blob/master/CHANGELOG.md