I am using .Net core 3.1 and working on documenting API actions in Swagger and want to document request body so that it would show all details like data types, validations etc to the end users.
Currently, I am hard coding the schema in xml comments as follows-
/// <summary> /// Order Details /// </summary> /// <remarks> /// Parameter's description: /// /// { /// "productName": string, -- Required /// "isUsed: true, /// "orderDate": "2021-02-19T08:43:10.300Z", -- Required /// "discountDate": "2021-02-19T08:43:10.300Z" /// } /// </remarks> /// <returns>Returns Order results</returns> /// <response code="200">Order Placed</response> [HttpPost] [Route("Place Order")] public ActionResult<OrderPlacingResult> PlaceOrder(OrderPlaceParam orderPlaceParam) { /// } This gives the desired result and is feasible for small request body. However, if the request contains lots of parameters, it would not be advisable to hard code it in the description section.
Can anyone suggest a better way to document parameters such that it will give all the details that it provides in the schema.
Please note the request has no actual parameters, I want to document request body.




