Skip to content

Instantly share code, notes, and snippets.

View Marvin-Brouwer's full-sized avatar
😁

Marvin Brouwer Marvin-Brouwer

😁
View GitHub Profile
@Marvin-Brouwer
Marvin-Brouwer / FixRequiredFromBodyOperationFilter.cs
Created August 3, 2017 14:28
IOperationFilter that fixed the fact that swagger seems to ignore the RequiredAttribute for request bodies
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Controllers;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
namespace VRIS.API.OperationFilters
{
/// <summary>
/// <see cref="IOperationFilter"/> that fixed the fact that swagger seems to ignore the <see cref="RequiredAttribute"/> for request bodies