Skip to content

Commit

Permalink
Add AddFluentValidationRulesToSwagger (#79)
Browse files Browse the repository at this point in the history
closes #77
  • Loading branch information
idormenco committed Aug 8, 2021
1 parent 20d2975 commit 9795643
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions Src/DeUrgenta.Api/DeUrgenta.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<PackageReference Include="FluentValidation.AspNetCore" Version="10.3.0" />
<PackageReference Include="Hellang.Middleware.ProblemDetails" Version="5.3.0" />
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="9.0.0" />
<PackageReference Include="MicroElements.Swashbuckle.FluentValidation" Version="5.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
3 changes: 3 additions & 0 deletions Src/DeUrgenta.Api/Extensions/SwaggerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Reflection;
using MicroElements.Swashbuckle.FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
Expand Down Expand Up @@ -65,7 +66,9 @@ public static IServiceCollection AddSwaggerFor(this IServiceCollection services,
c.ExampleFilters();
});

services.AddFluentValidationRulesToSwagger();
services.AddSwaggerExamplesFromAssemblies(assemblies);

return services;
}

Expand Down

0 comments on commit 9795643

Please sign in to comment.