« Previous | Next » 

Revision e8a25d62

Parent 31d1d442
Child 9a94c848

Added by Iustin Pop over 11 years ago

Implement Query2 filter JSON (de)serialisation

This adds support for encoding/decoding Query2 filters to/from JSON,
in (hopefully) the same format as the Python code generates.

It also adds a simple unit-test to check that this conversion is
idempotent. Of note here is that, since the Filter data type is
recursive, we have to manually ensure that the generator for it
correctly "shrinks" at each step (first version crashed hard my
workstation after eating ~8GB of ram :).

Compared to the current Query2 implementation, the following changes
were done:

- style: shortened some names to match the Python ones (LessEqualThan
→ LE, etc.)
- changed FilterValue from string to an ADT that can encode both
quoted strings and numeric values, since this is actually what
qlang.py generates
- added support for EmptyField, which in hindsight it's an obvious
missing part :)

Signed-off-by: Iustin Pop <>
Reviewed-by: Agata Murawska <>


  • added
  • modified
  • copied
  • renamed
  • deleted

View differences