Skip to content

feat: Add optional /children route (Children STAC API Extension) #555

@jonhealy1

Description

@jonhealy1

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 /catalogs endpoint.
  • 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 collections index for resources where direct_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}/children
  • GET /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=Catalog
  • GET /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_ids field (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 /children endpoint is available when enabled via config.
  • The root landing page includes a rel="children" link.
  • The endpoint returns a valid Children response object containing mixed or filtered Catalog and Collection objects.
  • Supports the type query parameter for filtering.
  • (Optional) Supports pagination consistent with other list endpoints.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions