geopython / geopython/pygeofilter
cql2-json: BETWEEN expects the draft nested args shape; final-spec flat args raise TypeError
- Dominant language
- Python
- Stars
- 90
- Forks
- 44
- PR merge metrics
- No merged PRs in 30d
Description
OGC 21-065r2 (the final CQL2 standard) defines BETWEEN with a flat 3-element `args` array:
```json
{"op": "between", "args": [{"property": "height"}, 2, 5]}
```
`parsers/cql2_json/parser.py` reads the draft nested shape instead (`args[1][0]` / `args[1][1]`):
https://github.com/geopython/pygeofilter/blob/master/pygeofilter/parsers/cql2_json/parser.py#L139-L145
so a spec-conformant client's BETWEEN raises `TypeError: 'int' object is not subscriptable` inside the walker.
Repro:
```python
from pygeofilter.parsers.cql2_json import parse
parse({"op": "between", "args": [{"property": "height"}, 2, 5]})
# TypeError
parse({"op": "between", "args": [{"property": "height"}, [2, 5]]}) # draft shape parses
```
Spec reference: https://docs.ogc.org/is/21-065r2/21-065r2.html (BETWEEN is defined over three scalar expression operands; the JSON encoding's args is flat).
Found while wiring pygeofilter 0.4.0 into an OGC API Features Part 3 endpoint; we currently pre-normalize the flat shape to the nested one before calling `parse`.
Contributor guide
Research direction
Start in parsers/cql2_json/parser.py around lines 139-145 and run the flat-shape reproduction from the issue. Trace how BETWEEN operands are read, then add coverage for the final-spec three-element args form. Done means the flat form parses without TypeError while preserving the existing supported behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100