stac-utils / stac-utils/stac-fastapi

Need a new way to declare behaviour and modification of API from extensions

Open
#178 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api layer vendor extension
Dominant language
Python
Stars
324
Forks
126
Avg merge
1d 22h
Merged PRs (30d)
10

Description

While writing code to add the filters extension it became clear that it was difficult for downstream applications to dynamically register the extensions they implement and for this to modify the response without also needing to update the implementation.

There are 3 things that extensions do in the call/response flow:

  1. Add an additional, stand-alone endpoint
  2. Modify the response from an existing endpoint
  3. Modify the queryset behind the response on an existing endpoint

The current framework works well with additional, stand-alone modifications. The other two rely on adding:

if self.extension_is_enabled(<ExtensionClass>):
     # Do something

constructs from within the "Core" client.

It would be nice if extensions define the logic and perhaps some base implementation or abstract implementation for the additions and modifications to the basic STAC API implementation.

Of course, depending on the extension, some implementation-specific code would need to be written to define the interaction between the extension and the database but it would be good to be able to keep this out of the core.

I will continue to have a think about how this might be accomplished and will make a PR if I come up with anything, but as this will be significant work, it would be good to get some feedback. Or if someone else wants to make a start... 😉

Would also impact #175

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Core client logic around extension_is_enabled and the existing standalone extension handling described in the issue. Consider how extensions could register standalone endpoints, response changes, and queryset changes without core conditionals, and use #175 as related context. Done would require an agreed design and implementation approach, but the issue names no files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, python
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.