title: How to configure OpenApiRequestBody in Azure Function?
body: <p>I want to decorate my azure c# function with OpenApi annotations. The function accept JSON schema as parameters. How to mention that in the annotation.</p>
  <p>Want to know how to configure below annotation</p>
  <p><code>[OpenApiRequestBody(contentType: &quot;json&quot;, bodyType: typeof(System.Text.Json.JsonDocument), Description = &quot;Parameters&quot;,Example =typeof(Parameters))]</code></p>
  <pre><code>public class ModifyOrder
      {
          [FunctionName(&quot;ModifyOrder&quot;)]
          [OpenApiOperation(operationId: &quot;run&quot;, tags: new[] { &quot;Modify Order&quot; })]
          [OpenApiSecurity(&quot;function_key&quot;, SecuritySchemeType.ApiKey, Name = &quot;code&quot;, In = OpenApiSecurityLocationType.Query)]
          [OpenApiRequestBody(contentType: &quot;json&quot;, bodyType: typeof(System.Text.Json.JsonDocument), Description = &quot;Parameters&quot;,Example =typeof(Parameters))]
          [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: &quot;text/plain&quot;, bodyType: typeof(string), Description = &quot;The OK response&quot;)]
          public static async Task&lt;IActionResult&gt; run(
              [HttpTrigger(AuthorizationLevel.Function, &quot;put&quot;, Route = null )] HttpRequest req,
              ILogger log)
          {
              log.LogInformation($&quot;C# HTTP trigger function processed a request.&quot;);
  
              string ordernumber;
  
              string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
              dynamic data = JsonConvert.DeserializeObject(requestBody);
              ordernumber = data?.orderno;
  
              string responseMessage = $&quot;Order:{ordernumber}&quot;;
              return new OkObjectResult(responseMessage);
          }
  
      }
  
      [OpenApiExample(typeof(Parameters))]
      public class Parameters 
      {
          /// &lt;summary&gt;The id of the customer in the context. This is also called payer, sub_account_id.&lt;/summary&gt;
          [Newtonsoft.Json.JsonProperty(&quot;customerId&quot;, Required = Newtonsoft.Json.Required.Always)]
          [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
          public string CustomerId { get; set; }
          /// &lt;summary&gt;The order number. Used to uniquely identify a group of order lines.&lt;/summary&gt;
          [Newtonsoft.Json.JsonProperty(&quot;orderNumber&quot;, Required = Newtonsoft.Json.Required.Always)]
          [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)]
          public string OrderNumber { get; set; }
      }
  </code></pre>