Skip to content

Commit 55e1ddd

Browse files
use literal instead of Enum for FilterLang (#686)
1 parent b9cfe2d commit 55e1ddd

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

CHANGES.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
# Changelog
22

3+
## [Unreleased] - TBD
4+
5+
## Changed
6+
7+
* replace Enum with `Literal` for `FilterLang`
8+
39
## [3.0.0a0] - 2024-05-06
410

511
### Added
612

713
* Add enhanced middleware configuration to the StacApi class, enabling specific middleware options and dynamic addition post-application initialization. ([#442](https://github.com/stac-utils/stac-fastapi/pull/442))
814
* Add Response Model to OpenAPI, even if model validation is turned off ([#625](https://github.com/stac-utils/stac-fastapi/pull/625))
915

10-
## Changes
16+
## Changed
1117

1218
* Update to pydantic v2 and stac_pydantic v3 ([#625](https://github.com/stac-utils/stac-fastapi/pull/625))
1319
* Removed internal Search and Operator Types in favor of stac_pydantic Types ([#625](https://github.com/stac-utils/stac-fastapi/pull/625))

stac_fastapi/extensions/stac_fastapi/extensions/core/filter/request.py

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,13 @@
11
"""Filter extension request models."""
22

3-
from enum import Enum
4-
from typing import Any, Dict, Optional
3+
from typing import Any, Dict, Literal, Optional
54

65
import attr
76
from pydantic import BaseModel, Field
87

98
from stac_fastapi.types.search import APIRequest
109

11-
12-
class FilterLang(str, Enum):
13-
"""Choices for filter-lang value in a POST request.
14-
15-
Based on
16-
https://github.com/stac-api-extensions/filter#queryables
17-
18-
Note the addition of cql2-json, which is used by the pgstac backend,
19-
but is not included in the spec above.
20-
"""
21-
22-
cql_json = "cql-json"
23-
cql2_json = "cql2-json"
24-
cql2_text = "cql2-text"
10+
FilterLang = Literal["cql-json", "cql2-json", "cql2-text"]
2511

2612

2713
@attr.s

0 commit comments

Comments
 (0)