-
Notifications
You must be signed in to change notification settings - Fork 1
Document filtering by type for children endpoint #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This PR proposes adding an optional `type` query parameter to the `/children` endpoint to support filtering results by resource type (e.g., `Catalog` or `Collection`). ### Motivation While the specification recommends separating different types into different hierarchy branches as a best practice, real-world data organization often results in "mixed content" folders (e.g., a Project Catalog containing both sub-project Catalogs and direct Dataset Collections). In dynamic, database-backed APIs (like those using Elasticsearch), retrieving and paginating mixed-type lists can be computationally expensive and complex to implement. Adding a standard `type` parameter allows: 1. **Backend Optimization:** Implementations can execute efficient, type-specific queries (e.g., `type: "Catalog"`) rather than fetching all children and filtering in memory. 2. **Client Flexibility:** Clients can request only the resource type they are interested in (e.g., "Show me sub-folders" vs. "Show me datasets") without receiving unwanted data. 3. **Standardization:** Prevents the proliferation of custom filter parameters (e.g., `?kind=`, `?filter=`) across different implementations. ### Proposed Change Add a section detailing the `type` parameter: #### Filtering by Type Implementations MAY support a `type` query parameter to allow clients to request a specific resource type. * `GET .../children?type=Catalog` * `GET .../children?type=Collection`
m-mohr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm fine with the functionality in general, but as it's optional clients may run into issues as they don't know whether it's supported or not. As such, I'd propose to make it an optional conformance class. Something like https://api.stacspec.org/v1.0.0-rc.2/children#type-filter. Should be listed at the top and in the section.
Additionally, you'd need to update the TOC and the OpenAPI document.
Co-authored-by: Matthias Mohr <[email protected]>
Co-authored-by: Matthias Mohr <[email protected]>
@jonhealy1 I think this^ is still open. Now that #6 is merged, the CI also fails due to the outdated TOC, I think. Can you please update this PR accordingly? Otherwise, I think it looks good. Changed the base after the merging #6 and tried to resolve the conflicts... |
Updated the section header for 'Filtering by Type' to use proper Markdown formatting.
Added 'type' query parameter to filter catalogs or collections.
Formatted parameters section for consistency.
|
@m-mohr Passing :) |
README.md
Outdated
| { | ||
| "rel": "children", | ||
| "type": "application/json", | ||
| "href": "https://stac-api.example/drones/children" | ||
| }, | ||
| { | ||
| "rel": "child", | ||
| "type": "application/json", | ||
| "title": "Flight 1", | ||
| "href": "https://stac-api.example/drones/filght-1" | ||
| }, | ||
| { | ||
| "rel": "child", | ||
| "type": "application/json", | ||
| "title": "Flight 2", | ||
| "href": "https://stac-api.example/drones/flight-2" | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The links seem to be duplicate.
Co-authored-by: Matthias Mohr <[email protected]>
This PR proposes adding an optional
typequery parameter to the/childrenendpoint to support filtering results by resource type (e.g.,CatalogorCollection).Motivation
While the specification recommends separating different types into different hierarchy branches as a best practice, real-world data organization often results in "mixed content" folders (e.g., a Project Catalog containing both sub-project Catalogs and direct Dataset Collections).
In dynamic, database-backed APIs (like those using Elasticsearch), retrieving and paginating mixed-type lists can be computationally expensive and complex to implement.
Adding a standard
typeparameter allows:type: "Catalog") rather than fetching all children and filtering in memory.?kind=,?filter=) across different implementations.Proposed Change
Add a section detailing the
typeparameter:Filtering by Type
Implementations MAY support a
typequery parameter to allow clients to request a specific resource type.GET .../children?type=CatalogGET .../children?type=CollectionRelated Issue(s):
Proposed Changes:
PR Checklist: