Skip to content

Commit

Permalink
Removed cql2-text in supported filter-lang for `FilterExtensionPo…
Browse files Browse the repository at this point in the history
…stRequest` model (#755)

* Removed `cql2-text` in supported `filter-lang` for `FilterExtensionPostRequest` model

* update tests
  • Loading branch information
vincentsarago authored Oct 1, 2024
1 parent 753341f commit 0ce70ba
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Removed

* Removed `cql2-text` in supported `filter-lang` for `FilterExtensionPostRequest` model (as per specification)

## [3.0.2] - 2024-09-20

### Added
Expand Down
2 changes: 1 addition & 1 deletion stac_fastapi/api/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def get_search(
"collections": ["test"],
"filter": {},
"filter-crs": "EPSG:4326",
"filter-lang": "cql2-text",
"filter-lang": "cql2-json",
},
)

Expand Down
4 changes: 2 additions & 2 deletions stac_fastapi/api/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def route(model=Depends(request_model)):

@pytest.mark.parametrize(
"filter,passes",
[(None, True), ({"test": "test"}, True), ("test==test", False), ([], False)],
[(None, True), ({"test": "test"}, True), ([], False)],
)
def test_create_post_request_model(filter, passes):
request_model = create_post_request_model(
Expand All @@ -82,7 +82,7 @@ def test_create_post_request_model(filter, passes):
datetime="2020-01-01T00:00:00Z",
limit=10,
filter=filter,
**{"filter-crs": "epsg:4326", "filter-lang": "cql2-text"},
**{"filter-crs": "epsg:4326", "filter-lang": "cql2-json"},
)

assert model.collections == ["test1", "test2"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class FilterExtensionPostRequest(BaseModel):
default=None,
description="The coordinate reference system (CRS) used by spatial literals in the 'filter' value. Default is `http://www.opengis.net/def/crs/OGC/1.3/CRS84`", # noqa: E501
)
filter_lang: Optional[FilterLang] = Field(
filter_lang: Optional[Literal["cql-json", "cql2-json"]] = Field(
alias="filter-lang",
default="cql2-json",
description="The CQL filter encoding that the 'filter' value uses.",
Expand Down
4 changes: 2 additions & 2 deletions stac_fastapi/extensions/tests/test_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ def test_search_filter_post_filter_lang_default(client: TestClient):

def test_search_filter_post_filter_lang_non_default(client: TestClient):
"""Test search POST endpoint with filter ext."""
filter_lang_value = "cql2-text"
filter_lang_value = "cql-json"
response = client.post(
"/search",
json={
"collections": ["test"],
"filter": {"op": "=", "args": [{"property": "test_property"}, "test-value"]},
"filter": {"eq": [{"property": "test_property"}, "test-value"]},
"filter-lang": filter_lang_value,
},
)
Expand Down

0 comments on commit 0ce70ba

Please sign in to comment.