Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion docs/guide/http/validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ with your own metadata if you need to use a different status code like this:
[ProducesResponseType(typeof(ProblemDetails), 418)]
```

### Using ProblemDetails with Marten aggregates
### Using ProblemDetails with Marten Aggregates

Of course, if you are using [Marten's aggregates within your Wolverine http handlers](./marten), you also want to be able to validation using the aggregate's details in your middleware and this is perfectly possible like this:

Expand Down Expand Up @@ -317,6 +317,21 @@ pattern in the generated code (basically from `AddScoped<T>(s => build it at run
more explicit `Validate` or `ValidateAsync()` method directly in your HTTP endpoint class for the data input.
:::

::: warning
If you are using `ExtensionDiscovery.ManualOnly`, you must explicitly call `opts.UseFluentValidationProblemDetail()` in
your Wolverine configuration in addition to `opts.UseFluentValidation()`. Without this, the `IProblemDetailSource<T>`
service will not be registered and the middleware will fail at runtime. With the default `ExtensionDiscovery.Automatic`
mode, these services are registered automatically by the `WolverineFx.Http.FluentValidation` extension.

```csharp
services.AddWolverine(ExtensionDiscovery.ManualOnly, opts =>
{
opts.UseFluentValidation();
opts.UseFluentValidationProblemDetail(); // Required in manual discovery mode!
});
```
:::

Wolverine.Http has a separate package called `WolverineFx.Http.FluentValidation` that provides a simple middleware
for using [Fluent Validation](https://docs.fluentvalidation.net/en/latest/) in your HTTP endpoints.

Expand Down
Loading