我正在使用 ASP.NET Core 1.1 API 并尝试使用 Path 和 Query 参数创建一个 GET api,其中:
[HttpGet]
[Route("users/{stationId}/{stationSite}")]
public IActionResult GetUsers(int stationId, int stationSiteid, [FromQuery] Paging properties)...
分页是一个对象:
public int CurrentIndex {get; set;}
public int ItemsPerPage {get; set;}
现在,我需要这样的电话才能工作:
api/users/1/2?currentIndex=1&itemsPerPage=10
在FromQuery
不工作,它出现在扬鞭,但没有通过正确的价值观,以API。
我错过了什么吗?
使用 Swashbuckle 的预发布版本会导致这种混乱。
此属性未在 Swagger 上列出,但使用 Postman 测试 API,它有效。
将 Swashbuckle 降级到 4.0.0 稳定版,效果很好。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句