Skip to content

Commit 2530d39

Browse files
authored
Fix sub catalog description (#596)
**Related Issue(s):** - #594 **Description:** docs: clarify flat canonical URL structure for catalogs - Explicitly state that nested routes (e.g. /catalogs/a/catalogs/b) are not supported - Update README examples to show canonical access pattern - Fixes #594 **PR Checklist:** - [x] Code is formatted and linted (run `pre-commit run --all-files`) - [x] Tests pass (run `make test`) - [x] Documentation has been updated to reflect changes, if applicable - [x] Changes are added to the changelog
1 parent 0ee60e2 commit 2530d39

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1111

1212
### Changed
1313

14+
- Updated catalog documentation to clarify that all catalogs use flat canonical endpoints (`/catalogs/{catalog_id}`) regardless of hierarchy depth. Nested routes like `/catalogs/id1/catalogs/id2` are not supported. Child discovery uses `/catalogs/{catalog_id}/catalogs` which returns links to canonical endpoints. [#596](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/596)
15+
1416
### Fixed
1517

1618
- Fixed bulk_sync_prep_create_item to properly detect duplicates across indexes. [#575](https://github.com/stac-utils/stac-fastapi-elasticsearch-opensearch/pull/575)

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,15 @@ To link an **existing** Catalog or Collection to a new parent, simply `POST` it
418418
2. **If YES (Link):** The API adds the new parent to the resource's `parent_ids` list. No data is duplicated.
419419
3. **If NO (Create):** The API creates a new resource.
420420

421+
#### Important: Flat Catalog URL Structure
422+
423+
All catalogs are accessed via the **flat canonical endpoint** `/catalogs/{catalog_id}`, regardless of their position in the hierarchy. Nested routes like `/catalogs/id1/catalogs/id2` are **not supported**. This ensures consistent, cacheable URLs regardless of catalog depth or parent relationships.
424+
425+
To discover a catalog's children, use `/catalogs/{catalog_id}/catalogs` or `/catalogs/{catalog_id}/children`, which returns links to the child catalogs' canonical endpoints.
426+
421427
#### Example: Creating a "Forestry" Playlist
422428

423-
Imagine you have an existing catalog `sentinel-2` stored under `providers/esa`. You want to create a curated "Forestry" catalog that includes this existing data.
429+
Imagine you have an existing catalog `sentinel-2`. You want to create a curated "Forestry" catalog that includes this existing data.
424430

425431
```bash
426432
# 1. Create the new Forestry catalog
@@ -445,13 +451,22 @@ curl -X POST "http://localhost:8081/catalogs/forestry/catalogs" \
445451
"description": "Sentinel-2 satellite imagery",
446452
"title": "Sentinel-2"
447453
}'
454+
455+
# 3. Access the sentinel-2 catalog via its canonical endpoint
456+
curl "http://localhost:8081/catalogs/sentinel-2"
457+
458+
# 4. Discover sentinel-2 as a child of forestry
459+
curl "http://localhost:8081/catalogs/forestry/catalogs"
460+
# This returns links to /catalogs/sentinel-2 (canonical endpoint)
448461
```
449462

450-
**Result:** The sentinel-2 catalog is now accessible via both paths:
451-
- `/catalogs/providers/esa/catalogs/sentinel-2`
452-
- `/catalogs/forestry/catalogs/sentinel-2`
463+
**Result:** The sentinel-2 catalog now has multiple parents (including forestry). It is always accessed via its canonical endpoint:
464+
- `/catalogs/sentinel-2`
465+
466+
You can discover it as a child of forestry via:
467+
- `/catalogs/forestry/catalogs` (lists sentinel-2 with a link to `/catalogs/sentinel-2`)
453468

454-
Because you are linking the node (the Catalog), the entire sub-tree attached to that node is automatically shared. If sentinel-2 contains millions of items and sub-catalogs, they are all instantly visible under the new forestry path without needing to re-link individual items.
469+
Because you are linking the node (the Catalog), the entire sub-tree attached to that node is automatically shared. If sentinel-2 contains millions of items and sub-catalogs, they are all instantly visible under the new forestry parent without needing to re-link individual items.
455470

456471
> **Configuration**: The catalogs route can be enabled or disabled by setting the `ENABLE_CATALOGS_ROUTE` environment variable to `true` or `false`. By default, this endpoint is **disabled**.
457472

0 commit comments

Comments
 (0)