Skip to content

Commit 0333a01

Browse files
author
Bart Koelman
committed
Updated documentation
1 parent d12eec7 commit 0333a01

File tree

3 files changed

+435
-0
lines changed

3 files changed

+435
-0
lines changed

docs/usage/reading/filtering.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Expressions are composed using the following functions:
2424
| Ends with text | `endsWith` | `?filter=endsWith(description,'End')` |
2525
| Equals one value from set | `any` | `?filter=any(chapter,'Intro','Summary','Conclusion')` |
2626
| Collection contains items | `has` | `?filter=has(articles)` |
27+
| Type-check derived type (v5) | `isType` | `?filter=isType(,men)` |
2728
| Negation | `not` | `?filter=not(equals(lastName,null))` |
2829
| Conditional logical OR | `or` | `?filter=or(has(orders),has(invoices))` |
2930
| Conditional logical AND | `and` | `?filter=and(has(orders),has(invoices))` |
@@ -86,6 +87,31 @@ GET /customers?filter=has(orders,not(equals(status,'Paid'))) HTTP/1.1
8687

8788
Which returns only customers that have at least one unpaid order.
8889

90+
_since v5.0_
91+
92+
Use the `isType` filter function to perform a type check on a derived type. You can pass a nested filter, where the derived fields are accessible.
93+
The first parameter can be used to perform the type check on a to-one relationship path.
94+
95+
Only return men:
96+
```http
97+
GET /humans?filter=isType(,men) HTTP/1.1
98+
```
99+
100+
Only return men with beards:
101+
```http
102+
GET /humans?filter=isType(,men,equals(hasBeard,'true')) HTTP/1.1
103+
```
104+
105+
Only return people whose best friend is a man with children:
106+
```http
107+
GET /humans?filter=isType(bestFriend,men,has(children)) HTTP/1.1
108+
```
109+
110+
Only return people who have at least one female married child:
111+
```http
112+
GET /humans?filter=has(children,isType(,woman,not(equals(husband,null)))) HTTP/1.1
113+
```
114+
89115
# Legacy filters
90116

91117
The next section describes how filtering worked in versions prior to v4.0. They are always applied on the set of resources being requested (no nesting).

0 commit comments

Comments
 (0)