我有一个复杂的对象要在 ASP.Net Core 3.2 中作为查询字符串传递。
public class Customer
{
public string Firstname { get; set; }
public List<Address> Addresses { get; set; }
}
public class Address
{
public string Home_Address { get; set; }
public string Office_Address { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
它在 Postman 中的工作方式如下:
http://localhost:52100/v1/Customer?Addresses[0].Home_Address=123HomeStreet&Addresses[0].Office_Address=123OfficeStreet
Run Code Online (Sandbox Code Playgroud)
但是,如何在地址类型为“array[object](查询)”的 Swagger 文档中传递值 http://localhost:52100/v1/swagger-ui/index.html
我在我的项目中添加了 Swashbuckle.AspNetCore 5.4.1、Swashbuckle.AspNetCore.Annotations 5.4.1、Swashbuckle.AspNetCore.Filters 5.1.1 引用