Skip to content

update geojson-pydantic req #217

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

Merged
merged 4 commits into from
May 6, 2025
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 @@ -8,6 +8,10 @@ Note: Minor version `0.X.0` update might break the API, It's recommended to pin

## [unreleased]

## [1.1.0] - 2025-05-06

* update geojson-pydantic requirement to `>=1.0,<3.0`

## [1.0.1] - 2025-03-17

* fix typo when using catalog_ttl
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies = [
"morecantile>=5.0,<7.0",
"pydantic>=2.4,<3.0",
"pydantic-settings~=2.0",
"geojson-pydantic>=1.0,<2.0",
"geojson-pydantic>=1.0,<3.0",
"pygeofilter>=0.2.0,<0.3.0",
"ciso8601~=2.3",
"starlette-cramjam>=0.4,<0.5",
Expand All @@ -44,8 +44,7 @@ test = [
"pytest-benchmark",
"httpx",
"pytest-postgresql",
"mapbox-vector-tile",
"protobuf>=3.0,<4.0",
"mapbox-vector-tile>=2.1",
"numpy",
]
dev = [
Expand Down
26 changes: 15 additions & 11 deletions tipg/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@
)
from tipg.errors import MissingGeometryColumn, NoPrimaryKey, NotFound
from tipg.resources.enums import MediaType
from tipg.resources.response import GeoJSONResponse, SchemaJSONResponse, orjsonDumps
from tipg.resources.response import (
GeoJSONResponse,
ORJSONResponse,
SchemaJSONResponse,
orjsonDumps,
)
from tipg.settings import FeaturesSettings, MVTSettings, TMSSettings

from fastapi import APIRouter, Depends, Path, Query
from fastapi.responses import ORJSONResponse

from starlette.datastructures import QueryParams
from starlette.requests import Request
Expand Down Expand Up @@ -596,17 +600,17 @@ def collections(
)
for collection in collection_list["collections"]
],
)
).model_dump(exclude_none=True, mode="json")

if output_type == MediaType.html:
return self._create_html_response(
request,
data.model_dump(exclude_none=True, mode="json"),
data,
template_name="collections",
title="Collections list",
)

return data
return ORJSONResponse(data)

def _collection_route(self):
@self.router.get(
Expand Down Expand Up @@ -689,17 +693,17 @@ def collection(
),
*self._additional_collection_tiles_links(request, collection),
],
)
).model_dump(exclude_none=True, mode="json")

if output_type == MediaType.html:
return self._create_html_response(
request,
data.model_dump(exclude_none=True, mode="json"),
data,
template_name="collection",
title=f"{collection.id} collection",
)

return data
return ORJSONResponse(data)

def _queryables_route(self):
@self.router.get(
Expand Down Expand Up @@ -735,17 +739,17 @@ def queryables(
title=collection.id,
link=self_url + qs,
properties=collection.queryables,
)
).model_dump(exclude_none=True, mode="json", by_alias=True)

if output_type == MediaType.html:
return self._create_html_response(
request,
data.model_dump(exclude_none=True, mode="json"),
data,
template_name="queryables",
title=f"{collection.id} queryables",
)

return data
return SchemaJSONResponse(data)

def _items_route(self): # noqa: C901
@self.router.get(
Expand Down
Loading