You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGES.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,10 @@
6
6
7
7
- Remove defaults in OpenAPI schemas
8
8
9
+
### Added
10
+
11
+
- add `enable_direct_response` settings to by-pass Pydantic validation and FastAPI serialization for responses
12
+
9
13
## [5.1.1] - 2025-03-17
10
14
11
15
### Fixed
@@ -373,7 +377,7 @@ Full changelog: https://stac-utils.github.io/stac-fastapi/migrations/v3.0.0/#cha
373
377
### Added
374
378
375
379
* Nginx service as second docker-compose stack to demonstrate proxy ([#503](https://github.com/stac-utils/stac-fastapi/pull/503))
376
-
* Validation checks in CI using [stac-api-validator](github.com/stac-utils/stac-api-validator) ([#508](https://github.com/stac-utils/stac-fastapi/pull/508))
380
+
* Validation checks in CI using [stac-api-validator](https://github.com/stac-utils/stac-api-validator) ([#508](https://github.com/stac-utils/stac-fastapi/pull/508))
377
381
* Required links to the sqlalchemy ItemCollection endpoint ([#508](https://github.com/stac-utils/stac-fastapi/pull/508))
378
382
* Publication of docker images to GHCR ([#525](https://github.com/stac-utils/stac-fastapi/pull/525))
<palign="center">FastAPI implemention of the STAC API spec.</p>
6
6
</p>
7
7
<palign="center">
@@ -21,25 +21,35 @@
21
21
22
22
---
23
23
24
-
Python library for building a STAC compliant FastAPI application. The project is split up into several namespace
25
-
packages:
24
+
Python library for building a STAC-compliant FastAPI application.
26
25
27
-
| Package | Description | Version
28
-
| ------- |------------- | -------
29
-
[**stac_fastapi.api**](https://github.com/stac-utils/stac-fastapi/tree/main/stac_fastapi/api) | An API layer which enforces the [stac-api-spec](https://github.com/radiantearth/stac-api-spec). | [](https://pypi.org/project/stac-fastapi.api)
30
-
[**stac_fastapi.extensions**](https://github.com/stac-utils/stac-fastapi/tree/main/stac_fastapi/extensions) | Abstract base classes for [STAC API extensions](https://github.com/radiantearth/stac-api-spec/blob/master/extensions.md) and third-party extensions. | [](https://pypi.org/project/stac-fastapi.extensions)
31
-
[**stac_fastapi.types**](https://github.com/stac-utils/stac-fastapi/tree/main/stac_fastapi/types) | Shared types and abstract base classes used by the library. | [](https://pypi.org/project/stac-fastapi.types)
26
+
`stac-fastapi` was initially developed by [arturo-ai](https://github.com/arturo-ai).
27
+
28
+
The project contains several namespace packages:
29
+
30
+
| Package | Description | Version |
31
+
| ------- |------------- | ------- |
32
+
|[**stac_fastapi.api**](https://github.com/stac-utils/stac-fastapi/tree/main/stac_fastapi/api)| An API layer which enforces the [stac-api-spec](https://github.com/radiantearth/stac-api-spec). |[](https://pypi.org/project/stac-fastapi.api)|
33
+
|[**stac_fastapi.extensions**](https://github.com/stac-utils/stac-fastapi/tree/main/stac_fastapi/extensions)| Abstract base classes for [STAC API extensions](https://github.com/radiantearth/stac-api-spec/blob/master/extensions.md) and third-party extensions. |[](https://pypi.org/project/stac-fastapi.extensions)|
34
+
|[**stac_fastapi.types**](https://github.com/stac-utils/stac-fastapi/tree/main/stac_fastapi/types)| Shared types and abstract base classes used by the library. |[](https://pypi.org/project/stac-fastapi.types)|
32
35
33
36
#### Backends
34
37
35
-
Backends are hosted in their own repositories:
38
+
In addition to the packages in this repository, a server implemention will also require the selection of a backend to
39
+
connect with a database for STAC metadata storage. There are several different backend options, and each has their own
40
+
repository.
36
41
37
-
-[stac-fastapi-pgstac](https://github.com/stac-utils/stac-fastapi-pgstac): Postgres backend implementation with [PgSTAC](https://github.com/stac-utils/pgstac).
38
-
-[stac-fastapi-elasticsearch](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch): Backend implementation with [Elasticsearch](https://github.com/elastic/elasticsearch).
39
-
-[stac-fastapi-sqlalchemy](https://github.com/stac-utils/stac-fastapi-sqlalchemy): Postgres backend implementation with [sqlalchemy](https://www.sqlalchemy.org/).
42
+
The two most widely-used and supported backends are:
40
43
41
-
`stac-fastapi` was initially developed by [arturo-ai](https://github.com/arturo-ai).
44
+
-[stac-fastapi-pgstac](https://github.com/stac-utils/stac-fastapi-pgstac): [PostgreSQL](https://github.com/postgres/postgres) + [PostGIS](https://github.com/postgis/postgis) via [PgSTAC](https://github.com/stac-utils/pgstac).
45
+
-[stac-fastapi-elasticsearch-opensearch](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch): [Elasticsearch](https://github.com/elastic/elasticsearch) or [OpenSearch](https://github.com/opensearch-project/OpenSearch)
-[stac-fastapi-geoparquet)](https://github.com/stac-utils/stac-fastapi-geoparquet): [GeoParquet](https://geoparquet.org) via [stacrs](https://github.com/stac-utils/stacrs) (experimental)
-[stac-fastapi-sqlalchemy](https://github.com/stac-utils/stac-fastapi-sqlalchemy): [PostgreSQL](https://github.com/postgres/postgres) + [PostGIS](https://github.com/postgis/postgis) via [SQLAlchemy](https://www.sqlalchemy.org/) (abandoned in favor of stac-fastapi-pgstac)
43
53
44
54
## Response Model Validation
45
55
@@ -51,16 +61,13 @@ To turn on response validation, set `ENABLE_RESPONSE_MODELS` to `True`. Either a
51
61
52
62
With the introduction of Pydantic 2, the extra [time it takes to validate models became negatable](https://github.com/stac-utils/stac-fastapi/pull/625#issuecomment-2045824578). While `ENABLE_RESPONSE_MODELS` still defaults to `False` there should be no penalty for users to turn on this feature but users discretion is advised.
Copy file name to clipboardExpand all lines: docs/src/tips-and-tricks.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,14 @@
2
2
3
3
This page contains a few 'tips and tricks' for getting **stac-fastapi** working in various situations.
4
4
5
+
## Avoid FastAPI (slow) serialization
6
+
7
+
When not using Pydantic validation for responses, FastAPI will still use a complex (slow) [serialization process](https://github.com/fastapi/fastapi/discussions/8165).
8
+
9
+
Starting with stac-fastapi `5.2.0`, we've added `ENABLE_DIRECT_RESPONSE` option to by-pass the default FastAPI serialization by wrapping the endpoint responses into `starlette.Response` classes.
By default the `StacApi` class will enable 3 Middlewares (`BrotliMiddleware`, `CORSMiddleware` and `ProxyHeaderMiddleware`). You may want to overwrite the defaults configuration by editing your backend's `app.py`:
0 commit comments