MicroElements.OpenApi.FluentValidation
7.1.10
Prefix Reserved
See the version list below for details.
dotnet add package MicroElements.OpenApi.FluentValidation --version 7.1.10
NuGet\Install-Package MicroElements.OpenApi.FluentValidation -Version 7.1.10
<PackageReference Include="MicroElements.OpenApi.FluentValidation" Version="7.1.10" />
<PackageVersion Include="MicroElements.OpenApi.FluentValidation" Version="7.1.10" />
<PackageReference Include="MicroElements.OpenApi.FluentValidation" />
paket add MicroElements.OpenApi.FluentValidation --version 7.1.10
#r "nuget: MicroElements.OpenApi.FluentValidation, 7.1.10"
#:package MicroElements.OpenApi.FluentValidation@7.1.10
#addin nuget:?package=MicroElements.OpenApi.FluentValidation&version=7.1.10
#tool nuget:?package=MicroElements.OpenApi.FluentValidation&version=7.1.10
Package Description
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- FluentValidation (>= 12.0.0)
-
net8.0
- FluentValidation (>= 12.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.5)
- Microsoft.Extensions.Options (>= 9.0.5)
-
net9.0
- FluentValidation (>= 12.0.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on MicroElements.OpenApi.FluentValidation:
| Package | Downloads |
|---|---|
|
MicroElements.Swashbuckle.FluentValidation
Swagger ISchemaFilter that uses FluentValidation validators instead System.ComponentModel based attributes. |
|
|
MicroElements.NSwag.FluentValidation
Adds FluentValidation rules to swagger schema. |
|
|
MicroElements.AspNetCore.OpenApi.FluentValidation
Applies FluentValidation rules to OpenAPI schemas generated by Microsoft.AspNetCore.OpenApi (IOpenApiSchemaTransformer). |
|
|
X2031.MicroElements.NSwag.FluentValidation
Adds FluentValidation rules to swagger schema. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 7.2.1 | 2,573 | 7/13/2026 |
| 7.2.0 | 1,309 | 7/12/2026 |
| 7.1.11 | 549 | 7/12/2026 |
| 7.1.10 | 159 | 7/12/2026 |
| 7.1.9 | 3,922 | 7/9/2026 |
| 7.1.8 | 15,884 | 7/1/2026 |
| 7.1.8-beta.2 | 368 | 6/21/2026 |
| 7.1.8-beta.1 | 82 | 6/20/2026 |
| 7.1.7 | 25,275 | 6/20/2026 |
| 7.1.7-beta.3 | 182 | 6/17/2026 |
| 7.1.7-beta.2 | 93 | 6/17/2026 |
| 7.1.7-beta.1 | 87 | 6/15/2026 |
| 7.1.6 | 54,812 | 6/2/2026 |
| 7.1.6-beta.1 | 76 | 6/2/2026 |
| 7.1.5-beta.2 | 631 | 5/16/2026 |
| 7.1.5-beta | 567 | 4/1/2026 |
| 7.1.4 | 334,944 | 3/29/2026 |
| 7.1.4-beta | 1,593 | 3/24/2026 |
| 7.1.3 | 12,080 | 3/24/2026 |
| 7.1.2 | 78,565 | 3/9/2026 |
$# Changes in 7.1.10
- Fixed: the same `[FromQuery]`/`[AsParameters]` DTO shared by more than one endpoint lost its FluentValidation rules on every endpoint after the first (Issue #223)
- `FluentValidationOperationFilter` runs once per operation. The Issue #180 cleanup removes the temporary container schema from `SchemaRepository.Schemas`, but Swashbuckle keeps the type in its internal reserved-ids map, which the cleanup does not touch. For the 2nd+ endpoint, `GetSchemaForType` → `GenerateSchema` then returns a bare `$ref` (no `Properties`) and the schema is no longer in `Schemas`, so the "has properties" guard was skipped and no rules were applied. Only reproduces with the default `RemoveUnusedQuerySchemas = 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 throwaway `SchemaRepository`. Fully isolated — it never mutates the shared repository or its reserved-id state — so the Issue #180 cleanup and all other `OperationFilter` behavior (required marking #209, nested `[FromQuery]` #211/#213, request bodies, #216) are preserved
# Changes in 7.1.9
- Fixed: numeric bounds from `short`/`byte`/`ushort`/`uint`/`ulong`/`sbyte`-typed rules were silently dropped (Issue #222)
- `IsNumeric` in the shared core (`MicroElements.OpenApi.FluentValidation`) only recognized `int`/`long`/`float`/`double`/`decimal`/`BigInteger`, so a `Between`/`Comparison` rule whose bound was a small integer type (e.g. `InclusiveBetween((short)1, (short)99)`) matched but produced no `minimum`/`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: `IsNumeric` now recognizes all integer primitives (`sbyte`/`byte`/`short`/`ushort`/`int`/`uint`/`long`/`ulong`) in addition to the floating/decimal/`BigInteger` types; `NumericToDecimal` already converted them all. One change in the shared core fixes all three providers (Swashbuckle, NSwag, and the native `Microsoft.AspNetCore.OpenApi` transformer)
# Changes in 7.1.8
- Security (Issue #220): closed a transitive high-severity advisory in the published package. `Swashbuckle.AspNetCore.SwaggerGen` on the net10.0 target was bumped `10.0.0` → `10.2.1`, which resolves `Microsoft.OpenApi` to the patched `2.7.5` (was `2.3.0`). This clears **GHSA-v5pm-xwqc-g5wc / CVE-2026-49451** (CWE-674 uncontrolled recursion — a circular `$ref` schema 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 `IFormFile` uploads (Issue #216): stable rollup of everything in `7.1.8-beta.1` and `7.1.8-beta.2` below (new File-level rules `.FileContentType()`, `.MaxFileSize()`, `.MinFileSize()`, `.FileSizeBetween()`; Swashbuckle / NSwag / Microsoft.AspNetCore.OpenApi emit multipart `encoding.contentType` and description annotations)
# Changes in 7.1.8-beta.2
- All of `7.1.8-beta.1` below, plus: **Microsoft.AspNetCore.OpenApi** now also emits `encoding.contentType` for the file part (Issue #216) — the `FluentValidationOperationTransformer` writes `requestBody.content["multipart/form-data"].encoding.<part>.contentType` so 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 `$ref` component to find the part name)
# Changes in 7.1.8-beta.1
- Added: media type (content type) and file size validation for `IFormFile` uploads (Issue #216)
- New File-level FluentValidation rules in `MicroElements.OpenApi.FluentValidation` (namespace `MicroElements.OpenApi.FluentValidation.FileUpload`): `.FileContentType(params string[])`, `.MaxFileSize(long)`, `.MinFileSize(long)`, `.FileSizeBetween(long, long)` on `IRuleBuilder<T, IFormFile>`. They both enforce validation at runtime and surface metadata for OpenAPI generation
- Root cause: rules on nested `IFormFile` members (`RuleFor(x => x.File.Length)` / `RuleFor(x => x.File.ContentType)`) are named `File.Length` / `File.ContentType` and never match the flat schema property `File`, so they were silently dropped; and `Must(...)` 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 property `description`. File size is never emitted as `maxLength` (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 part `description`. Register it alongside the schema processor: `settings.OperationProcessors.Add(serviceProvider.GetService<FluentValidationOperationProcessor>())`. Known NSwag limitation: `OpenApiEncoding.EncodingType` serializes as `encodingType` rather than the OpenAPI-spec `contentType` (through at least NSwag 14.7.x), so the `description` is the guaranteed-visible carrier
- **Microsoft.AspNetCore.OpenApi**: the allowed types and size limits are appended to the file property `description`, and (since `7.1.8-beta.2`) the allowed types are also emitted as `encoding.contentType` on 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)
Full release notes can be found at: https://github.com/micro-elements/MicroElements.Swashbuckle.FluentValidation/blob/master/CHANGELOG.md