api-guidelines
api-guidelines copied to clipboard
Filters: "in" operator
Frequently, there are filter expressions where the same attribute is compared with multiple values like -
$filter=categoryId eq 'cat1000' or categoryId eq 'cat1001' or categoryId eq 'cat1002'
It is very desirable to write the above as
$filter=categoryId in ['cat1000', 'cat1001', 'cat1002']
This is less verbose and much better for human readability and visual debugging, especially when combining multiple such filter conditions. Eg. $filter=categoryId in ['cat1000', 'cat1001', 'cat1002'] and productId not in ['201', '210'].