-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Description
This feature request proposes adding support for the STAC API - Children Extension to stac-fastapi-elasticsearch-opensearch.
This extension adds a /children endpoint that provides a list of all child Catalogs and Collections for a given resource. While our primary architectural focus for federation is the Catalogs Endpoint Extension (/catalogs), supporting /children provides compliance with standard STAC crawlers (like STAC Browser) and offers a standardized mechanism for simple link-based traversal.
Motivation
- Interoperability: Enables standard STAC clients (e.g., STAC Browser) that rely on link crawling to navigate the hierarchy effectively.
- Navigation Parity: Provides a complementary "Browse" view alongside the "Search/Manage" view provided by the
/catalogsendpoint. - Community Alignment: Implements a widely recognized extension for hierarchical discovery.
Proposed Implementation
The implementation should be optional, controlled by an environment variable (e.g., ENABLE_CHILDREN_ROUTE, default false).
1. Root Endpoint (GET /children)
- Returns a list of all top-level Catalogs and Collections.
- Logic: Query the
collectionsindex for resources wheredirect_parents(or equivalent field) indicates the root.
2. Recursive Endpoints (Deep Traversal)
To support deep browsing, the implementation should support the "Relative Traversal" pattern:
GET /catalogs/{catalog_id}/childrenGET /collections/{collection_id}/children(for nested collections)
3. Type Filtering (Recommended)
To ensure backend efficiency and predictable responses, the implementation should support the type parameter (as proposed in recent discussions):
GET /children?type=CatalogGET /children?type=Collection
Database Considerations
Since SFEOS uses a flattened index strategy, implementing /children requires efficient querying of immediate descendants only.
- We cannot use the recursive
parent_idsfield (which contains the full lineage). - We likely need to utilize a specific field (e.g.,
direct_parents) to filter for immediate children without returning the entire recursive sub-tree.
Acceptance Criteria
- The
/childrenendpoint is available when enabled via config. - The root landing page includes a
rel="children"link. - The endpoint returns a valid
Childrenresponse object containing mixed or filteredCatalogandCollectionobjects. - Supports the
typequery parameter for filtering. - (Optional) Supports pagination consistent with other list endpoints.