位置 - array/list 作为可选参数的问题

Locations - problem with array/list as optional param

请求 A:http://localhost:8080/api/organizations/1/scenarios?perProducts=1,

请求 B:http://localhost:8080/api/organizations/1/scenarios?perProducts=1,2

我的位置class:

            @Location("/scenarios")
            data class Scenarios(
                val organization: Organization,
                val startValue: Int = 0,
                val perPage: Int = 10,
                val perProducts: List<Int> = listOf(),
                val byName: String = ""
            )

如果我向路径(请求 a)添加一个产品 ID 一切正常,但如果我添加两个(请求 b)或更多 ID,我会收到“错误请求”作为响应。我做错了什么?

试试这个:

http://localhost:8080/api/organizations/1/scenarios?perProducts=1&perProducts=2

引擎盖下的位置使用 Data Convertion 功能,这是它处理多个值的一种方式。