Skip to content

Commit

Permalink
use literal instead of Enum for FilterLang (#686)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentsarago authored May 7, 2024
1 parent b9cfe2d commit 55e1ddd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
8 changes: 7 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# Changelog

## [Unreleased] - TBD

## Changed

* replace Enum with `Literal` for `FilterLang`

## [3.0.0a0] - 2024-05-06

### Added

* 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))
* Add Response Model to OpenAPI, even if model validation is turned off ([#625](https://github.com/stac-utils/stac-fastapi/pull/625))

## Changes
## Changed

* Update to pydantic v2 and stac_pydantic v3 ([#625](https://github.com/stac-utils/stac-fastapi/pull/625))
* Removed internal Search and Operator Types in favor of stac_pydantic Types ([#625](https://github.com/stac-utils/stac-fastapi/pull/625))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
"""Filter extension request models."""

from enum import Enum
from typing import Any, Dict, Optional
from typing import Any, Dict, Literal, Optional

import attr
from pydantic import BaseModel, Field

from stac_fastapi.types.search import APIRequest


class FilterLang(str, Enum):
"""Choices for filter-lang value in a POST request.
Based on
https://github.com/stac-api-extensions/filter#queryables
Note the addition of cql2-json, which is used by the pgstac backend,
but is not included in the spec above.
"""

cql_json = "cql-json"
cql2_json = "cql2-json"
cql2_text = "cql2-text"
FilterLang = Literal["cql-json", "cql2-json", "cql2-text"]


@attr.s
Expand Down

0 comments on commit 55e1ddd

Please sign in to comment.