diff --git a/stac_pydantic/api/search.py b/stac_pydantic/api/search.py index 2441d52..1623930 100644 --- a/stac_pydantic/api/search.py +++ b/stac_pydantic/api/search.py @@ -79,21 +79,15 @@ def validate_bbox(cls, v: BBox) -> BBox: raise ValueError( "Maximum elevation must greater than minimum elevation" ) - - if xmax < xmin: - raise ValueError( - "Maximum longitude must be greater than minimum longitude" - ) + # Validate against WGS84 + if xmin < -180 or ymin < -90 or xmax > 180 or ymax > 90: + raise ValueError("Bounding box must be within (-180, -90, 180, 90)") if ymax < ymin: raise ValueError( "Maximum longitude must be greater than minimum longitude" ) - # Validate against WGS84 - if xmin < -180 or ymin < -90 or xmax > 180 or ymax > 90: - raise ValueError("Bounding box must be within (-180, -90, 180, 90)") - return v @field_validator("datetime") diff --git a/tests/api/test_search.py b/tests/api/test_search.py index 67833a9..084e6e5 100644 --- a/tests/api/test_search.py +++ b/tests/api/test_search.py @@ -134,7 +134,6 @@ def test_search_geometry_bbox(): "bbox", [ (100.0, 1.0, 105.0, 0.0), # ymin greater than ymax - (100.0, 0.0, 95.0, 1.0), # xmin greater than xmax (100.0, 0.0, 5.0, 105.0, 1.0, 4.0), # min elev greater than max elev (-200.0, 0.0, 105.0, 1.0), # xmin is invalid WGS84 (100.0, -100, 105.0, 1.0), # ymin is invalid WGS84