|
|
|
|
|
by sophiabits
906 days ago
|
|
Instead of inventing your own DSL for filtering, there are also some well-specified standards. ODATA [1] is probably the main one, and it’s adopted by e.g. Microsoft’s Azure APIs. JSON:API [2] is another, although I’ve never seen it used anywhere personally. They’re both pretty heavy specifications so I’ve never bothered implementing anything that 100% follows them. But I have picked bits and pieces from time to time—in particular ODATA’s idea for filtering is nice and comprehensive imo, and there are a number of libraries in various languages which handle parsing its filter strings into structured data. [1] https://www.odata.org/
[2] https://jsonapi.org/ |
|