Skip to content

Commit c4e6ead

Browse files
use interally defined JSONResponse (#834)
1 parent b94c52c commit c4e6ead

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Fixed
66

77
- avoid future deprecation for pydantic.Field and use `json_schema_extra` instead of `openapi_examples`
8+
- use `orjson` based JSONResponse when available
89

910
## [5.2.0] - 2025-04-18
1011

stac_fastapi/api/stac_fastapi/api/app.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from stac_pydantic.shared import MimeTypes
1313
from stac_pydantic.version import STAC_VERSION
1414
from starlette.middleware import Middleware
15-
from starlette.responses import JSONResponse, Response
15+
from starlette.responses import Response
1616

1717
from stac_fastapi.api.errors import DEFAULT_STATUS_CODES, add_exception_handlers
1818
from stac_fastapi.api.middleware import CORSMiddleware, ProxyHeaderMiddleware
@@ -23,6 +23,7 @@
2323
GeoJSONResponse,
2424
ItemCollectionUri,
2525
ItemUri,
26+
JSONResponse,
2627
)
2728
from stac_fastapi.api.openapi import update_openapi
2829
from stac_fastapi.api.routes import (

stac_fastapi/api/stac_fastapi/api/errors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from fastapi.exceptions import RequestValidationError, ResponseValidationError
99
from starlette import status
1010
from starlette.requests import Request
11-
from starlette.responses import JSONResponse
1211

12+
from stac_fastapi.api.models import JSONResponse
1313
from stac_fastapi.types.errors import (
1414
ConflictError,
1515
DatabaseError,

stac_fastapi/api/stac_fastapi/api/openapi.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from fastapi import FastAPI
44
from starlette.requests import Request
5-
from starlette.responses import JSONResponse, Response
5+
from starlette.responses import Response
66
from starlette.routing import Route, request_response
77

88

@@ -22,7 +22,7 @@ def update_openapi(app: FastAPI) -> FastAPI:
2222
# Create a patched endpoint function that modifies the content type of the response
2323
async def patched_openapi_endpoint(req: Request) -> Response:
2424
# Get the response from the old endpoint function
25-
response: JSONResponse = await old_endpoint(req)
25+
response = await old_endpoint(req)
2626
# Update the content type header in place
2727
response.headers["content-type"] = "application/vnd.oai.openapi+json;version=3.0"
2828
# Return the updated response

stac_fastapi/extensions/stac_fastapi/extensions/core/transaction.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
from fastapi import APIRouter, Body, FastAPI
88
from stac_pydantic import Collection, Item, ItemCollection
99
from stac_pydantic.shared import MimeTypes
10-
from starlette.responses import JSONResponse, Response
10+
from starlette.responses import Response
1111
from typing_extensions import Annotated
1212

13-
from stac_fastapi.api.models import CollectionUri, ItemUri
13+
from stac_fastapi.api.models import CollectionUri, ItemUri, JSONResponse
1414
from stac_fastapi.api.routes import create_async_endpoint
1515
from stac_fastapi.types.config import ApiSettings
1616
from stac_fastapi.types.core import AsyncBaseTransactionsClient, BaseTransactionsClient

0 commit comments

Comments
 (0)