我正在尝试在 Swagger/OpenApi 中插入我自己的值,目前在模型示例值中我有以下值:
期望的情况如下图:
我研究过它并尝试了多种方法来实现此目的,例如我尝试添加如下 XMLComments:
然而这不起作用。然后我尝试使用提供此功能的 MapType 函数,我使用以下代码完成了此操作:
c.MapType<Student>(() => new Schema()
{
example = new Student()
{
StudentName = "John Doe",
Age = 28
}
});
Run Code Online (Sandbox Code Playgroud)
有任何解决这个问题的方法吗 ?