Skip to content

Commit 52809f8

Browse files
Merge pull request #217 from developmentseed/feature/update-geojson-pydantic
update geojson-pydantic req
2 parents 1a2e5eb + 619b32a commit 52809f8

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Note: Minor version `0.X.0` update might break the API, It's recommended to pin
88

99
## [unreleased]
1010

11+
## [1.1.0] - 2025-05-06
12+
13+
* update geojson-pydantic requirement to `>=1.0,<3.0`
14+
1115
## [1.0.1] - 2025-03-17
1216

1317
* fix typo when using catalog_ttl

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies = [
3030
"morecantile>=5.0,<7.0",
3131
"pydantic>=2.4,<3.0",
3232
"pydantic-settings~=2.0",
33-
"geojson-pydantic>=1.0,<2.0",
33+
"geojson-pydantic>=1.0,<3.0",
3434
"pygeofilter>=0.2.0,<0.3.0",
3535
"ciso8601~=2.3",
3636
"starlette-cramjam>=0.4,<0.5",
@@ -44,8 +44,7 @@ test = [
4444
"pytest-benchmark",
4545
"httpx",
4646
"pytest-postgresql",
47-
"mapbox-vector-tile",
48-
"protobuf>=3.0,<4.0",
47+
"mapbox-vector-tile>=2.1",
4948
"numpy",
5049
]
5150
dev = [

tipg/factory.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,15 @@
4444
)
4545
from tipg.errors import MissingGeometryColumn, NoPrimaryKey, NotFound
4646
from tipg.resources.enums import MediaType
47-
from tipg.resources.response import GeoJSONResponse, SchemaJSONResponse, orjsonDumps
47+
from tipg.resources.response import (
48+
GeoJSONResponse,
49+
ORJSONResponse,
50+
SchemaJSONResponse,
51+
orjsonDumps,
52+
)
4853
from tipg.settings import FeaturesSettings, MVTSettings, TMSSettings
4954

5055
from fastapi import APIRouter, Depends, Path, Query
51-
from fastapi.responses import ORJSONResponse
5256

5357
from starlette.datastructures import QueryParams
5458
from starlette.requests import Request
@@ -596,17 +600,17 @@ def collections(
596600
)
597601
for collection in collection_list["collections"]
598602
],
599-
)
603+
).model_dump(exclude_none=True, mode="json")
600604

601605
if output_type == MediaType.html:
602606
return self._create_html_response(
603607
request,
604-
data.model_dump(exclude_none=True, mode="json"),
608+
data,
605609
template_name="collections",
606610
title="Collections list",
607611
)
608612

609-
return data
613+
return ORJSONResponse(data)
610614

611615
def _collection_route(self):
612616
@self.router.get(
@@ -689,17 +693,17 @@ def collection(
689693
),
690694
*self._additional_collection_tiles_links(request, collection),
691695
],
692-
)
696+
).model_dump(exclude_none=True, mode="json")
693697

694698
if output_type == MediaType.html:
695699
return self._create_html_response(
696700
request,
697-
data.model_dump(exclude_none=True, mode="json"),
701+
data,
698702
template_name="collection",
699703
title=f"{collection.id} collection",
700704
)
701705

702-
return data
706+
return ORJSONResponse(data)
703707

704708
def _queryables_route(self):
705709
@self.router.get(
@@ -735,17 +739,17 @@ def queryables(
735739
title=collection.id,
736740
link=self_url + qs,
737741
properties=collection.queryables,
738-
)
742+
).model_dump(exclude_none=True, mode="json", by_alias=True)
739743

740744
if output_type == MediaType.html:
741745
return self._create_html_response(
742746
request,
743-
data.model_dump(exclude_none=True, mode="json"),
747+
data,
744748
template_name="queryables",
745749
title=f"{collection.id} queryables",
746750
)
747751

748-
return data
752+
return SchemaJSONResponse(data)
749753

750754
def _items_route(self): # noqa: C901
751755
@self.router.get(

0 commit comments

Comments
 (0)