OData V4 $expand 嵌套 $filter 和 $orderby -- 在 expand 中组合 $filter 和 $orderby

OData V4 $expand nested $filter and $orderby -- combine $filter and $orderby inside expand

我目前有一个具有以下模型的 OData V4 服务。
"Category" -- "Codes"
对于每个类别,可以有许多代码。

我需要 $expand 代码,$filter where Active = true 然后 $orderby Codes.Description.

目前,以下内容无需订购即可正常工作。

odata/Categories?$expand=Codes($filter=Active eq true)

这不起作用。

odata/Categories?$expand=Codes($filter=Active eq true&$orderby=Description)

我收到 "The query specified in the URI is not valid. Syntax error at position 12." & "Syntax error at position 12 in 'Description)'."

基本上它正在读取 "Description" 之后的最后一个“)”作为错误。

我无法在 OData V4 文档中找到它,但我确实在此处找到了类似的示例“How can I order objects according to some attribute of the child in OData?

http://services.odata.org/V4/Northwind/Northwind.svc/Orders?$select=OrderID&$expand=Order_Details($select=UnitPrice;$orderby=Quantity)

我缺少的关键是

;

这在过滤器和 orderby 之间。
这是工作 url

odata/Categories?$expand=Codes($filter=Active eq true;$orderby=Description)

OData V4 分组最后记录得到您的服务

odata/Categories?$expand=Codes($top=1;$orderby=Description)