Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed cql2-text in supported filter-lang for FilterExtensionPostRequest model #755

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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