Open LeoBreebaart opened 2 years ago
cql2-json is case sensitive. The JSON Schema has this explicitly:
"op": {
"type": "string",
"enum": [ "and", "or" ]
},
which means only those those two strings may be used.
My understanding of BNF literals is that they are always considered to be insensitive (someone who seemed to understand this told me then when I raised what I thought was an issue with RFC 3339 datetime parsing).
The
cql2_json
parser fails with a ValueError if I try to pass it an operator in uppercase, e.g."op": "or", "args": [...]
is fine, but"op": "OR", "args": [...]
fails. And indeed, in _cql2json/parser.py we find an explicit testif op in ("and", "or"):
(ditto for all the other operators, of course).What is the reasoning behind this?
cql2_text
is case-insensitive w.r.t. operators (on account of presumably deliberatecondition "OR"i
etc. specifications in the Lark grammar), but if I consult the CQL2 JSON standard spec I just see things likeorExpression = booleanExpression "OR" booleanExpression;
which to me would indicate either case insensitivity (haven't been able to quickly find out what the default is for BNF literals) or in fact mandatory uppercase...