|
44 | 44 | ) |
45 | 45 | from tipg.errors import MissingGeometryColumn, NoPrimaryKey, NotFound |
46 | 46 | 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 | +) |
48 | 53 | from tipg.settings import FeaturesSettings, MVTSettings, TMSSettings |
49 | 54 |
|
50 | 55 | from fastapi import APIRouter, Depends, Path, Query |
51 | | -from fastapi.responses import ORJSONResponse |
52 | 56 |
|
53 | 57 | from starlette.datastructures import QueryParams |
54 | 58 | from starlette.requests import Request |
@@ -596,17 +600,17 @@ def collections( |
596 | 600 | ) |
597 | 601 | for collection in collection_list["collections"] |
598 | 602 | ], |
599 | | - ) |
| 603 | + ).model_dump(exclude_none=True, mode="json") |
600 | 604 |
|
601 | 605 | if output_type == MediaType.html: |
602 | 606 | return self._create_html_response( |
603 | 607 | request, |
604 | | - data.model_dump(exclude_none=True, mode="json"), |
| 608 | + data, |
605 | 609 | template_name="collections", |
606 | 610 | title="Collections list", |
607 | 611 | ) |
608 | 612 |
|
609 | | - return data |
| 613 | + return ORJSONResponse(data) |
610 | 614 |
|
611 | 615 | def _collection_route(self): |
612 | 616 | @self.router.get( |
@@ -689,17 +693,17 @@ def collection( |
689 | 693 | ), |
690 | 694 | *self._additional_collection_tiles_links(request, collection), |
691 | 695 | ], |
692 | | - ) |
| 696 | + ).model_dump(exclude_none=True, mode="json") |
693 | 697 |
|
694 | 698 | if output_type == MediaType.html: |
695 | 699 | return self._create_html_response( |
696 | 700 | request, |
697 | | - data.model_dump(exclude_none=True, mode="json"), |
| 701 | + data, |
698 | 702 | template_name="collection", |
699 | 703 | title=f"{collection.id} collection", |
700 | 704 | ) |
701 | 705 |
|
702 | | - return data |
| 706 | + return ORJSONResponse(data) |
703 | 707 |
|
704 | 708 | def _queryables_route(self): |
705 | 709 | @self.router.get( |
@@ -735,17 +739,17 @@ def queryables( |
735 | 739 | title=collection.id, |
736 | 740 | link=self_url + qs, |
737 | 741 | properties=collection.queryables, |
738 | | - ) |
| 742 | + ).model_dump(exclude_none=True, mode="json", by_alias=True) |
739 | 743 |
|
740 | 744 | if output_type == MediaType.html: |
741 | 745 | return self._create_html_response( |
742 | 746 | request, |
743 | | - data.model_dump(exclude_none=True, mode="json"), |
| 747 | + data, |
744 | 748 | template_name="queryables", |
745 | 749 | title=f"{collection.id} queryables", |
746 | 750 | ) |
747 | 751 |
|
748 | | - return data |
| 752 | + return SchemaJSONResponse(data) |
749 | 753 |
|
750 | 754 | def _items_route(self): # noqa: C901 |
751 | 755 | @self.router.get( |
|
0 commit comments