在 C# Web Api 控制器中,如何装饰操作的参数,以便该参数的默认值以 swagger 形式显示?
You can try something like below, I am considering input object for Action method as Product as you have not mentioned anything explicitly in your question.
You can use ///<example>value </example>
tag in your Request Field.
public class Product { public int Id { get; set; }
///<summary> ///</summary> ///<example>example value</example> public string Description { get; set; }
}
For Default value of parameters in Action Methods, you can directly use as below:
/// <summary>
/// Action Method Summary
/// </summary>
/// <param name="Description">example value</param>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.