title: Body parameter required with swagger 4.0 Asp.net core 2.2
body: <p>I am using a swagger 4.0 with Asp.net core 2.2 Web Api. I want to tell the swagger UI on post/put method that some of the body content parameters are required. As I know that if the parameter is query parameter then it is required. Done some research <a href="https://swagger.io/docs/specification/2-0/describing-request-body/" rel="nofollow noreferrer">https://swagger.io/docs/specification/2-0/describing-request-body/</a> and found that the body content can be made required </p>
  
  <p><a href="https://i.stack.imgur.com/7Hpx3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7Hpx3.png" alt="swagger document"></a></p>
  
  <p>Some of the research from other link</p>
  
  <p><a href="https://stackoverflow.com/questions/53319588/how-to-mark-a-property-as-required-in-swagger-without-asp-net-model-validation">How to mark a property as required in Swagger, without ASP.NET model validation?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/41141137/how-can-i-tell-swashbuckle-that-the-body-content-is-required">How can I tell Swashbuckle that the body content is required?</a></p>
  
  <p><strong>Controller code</strong></p>
  
  <pre><code>[HttpPost]
          public async Task&lt;IActionResult&gt; Create([FromBody]LearningApplication model)
          {
              if (!ModelState.IsValid) return InvalidModelState(ModelState);
  
              // create the record,no need to provide resource auth as only admin can action this controller
              await _learningApplicationManager.CreateAsync(model, LearningApplicationValidator.OnCreateRuleset);
  
              return Created(url, model);
          }
  </code></pre>
  
  <p><strong>Model</strong></p>
  
  <pre><code>public class LearningApplication : BaseAuditableWithLogicalDeleteAggregate&lt;Guid&gt;
      {
  
          [Required(AllowEmptyStrings = false, ErrorMessage = "You must enter the name of the course or professional Learning session")]
          [DataMember]
          public string CourseName { get; set; }
  
          [Required(AllowEmptyStrings = false, ErrorMessage = "You must enter the professional Learning provider: ie. TGS, AGSV, etc")]
          [DataMember]
          public string Provider { get; set; }
  
          [DataMember]
          public string EventWebsite { get; set; }
  
          [DataMember]
          public string RegistrationExpenses { get; set; }
  
          [Required(ErrorMessage = "Please provide the Start Date &amp; time")]
          [DataMember]
          public DateTime? StartDateTime { get; set; }
  }
  </code></pre>
  
  <p><strong>Current Swagger display</strong></p>
  
  <p><a href="https://i.stack.imgur.com/kxQeI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kxQeI.png" alt="current swagger"></a></p>