Skip to content

PB-1677: sort extension - Add properties prefix #minor - #665

Open
asteiner-swisstopo wants to merge 12 commits into
developfrom
feat-PB-1677-add-properties-prefix-for-sortby
Open

PB-1677: sort extension - Add properties prefix #minor#665
asteiner-swisstopo wants to merge 12 commits into
developfrom
feat-PB-1677-add-properties-prefix-for-sortby

Conversation

@asteiner-swisstopo

@asteiner-swisstopo asteiner-swisstopo commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Follow-up of #664: Prepend properties. to certain parameters used in the sortby query parameter and in the /sortables endpoint:

  • datetime -> properties.datetime
  • title -> properties.title
  • created -> properties.created
  • updated -> properties.updated
  • id and collection stay unchanged (top-level fields)

In #663, we chose to omit the properties. prefix for the sortby query parameter. So we refer to datetime, not properties.datetime. This was because the "query" parameter of the POST /search endpoint also omits the properties. prefix.

Looking into the STAC Browser code, however, I see that the properties. prefix is the assumed default. I think then it would be better to follow the STAC Browser. The Query extension will anyway be replaced by the Filter extension (see PB-2392), so the inconsistency is ok.

That makes sure that the fields available in the sortby query param and
the ones reported in /sortable are in sync.
This is the same as /sortables except that it checks whether the
collection exists.
The link relation type is as given in [the specs of the sort
extension](https://github.com/stac-api-extensions/sort#sortables).
As we advertise the /sortables endpoints with `"type":
"application/schema+json"`, the stac-browser also tries to fetch the
JSON schema with schema+json. However, the STAC API cannot cope with
this Accept header (`Accept: application/schema+json`) and returns an
error:

```log
Request GET /api/stac/v1/collections/test-collection/sortables
Response 406: {'detail': ErrorDetail(string='Could not satisfy the
request Accept header.', code='not_acceptable')}
```

Therefore, we now also accept and render media type
"application/schema+json".
The SORTABLE_FIELDS is no longer just a dict of strings but contains
structured objects.
Follow-up of #664: Prepend `properties.` to certain parameters used in
the `sortby` query parameter and in the `/sortables` endpoint:

- `datetime` -> `properties.datetime`
- `title` -> `properties.title`
- `created` -> `properties.created`
- `updated` -> `properties.updated`
- `id` and `collection` stay unchanged (top-level fields)

In #663, we chose to omit the `properties.` prefix for the `sortby`
query parameter. So we refer to `datetime`, not `properties.datetime`.
This was because the "query" parameter of the [POST /search
endpoint](https://data.geo.admin.ch/api/stac/static/spec/v1/apitransactional.html#tag/STAC/operation/postSearchSTAC)
also omits the `properties.` prefix.

Looking into the STAC Browser code, however, I see that the
`properties.` prefix is the assumed default. I think then it would be
better to follow the STAC Browser. The Query extension will anyway be
replaced by the Filter extension (see PB-2392), so the inconsistency is
ok.
@asteiner-swisstopo asteiner-swisstopo added the WIP 🚧 Work in progress: workflow will prevent merging a PR with this label label Sep 9, 2026
@asteiner-swisstopo asteiner-swisstopo self-assigned this Sep 9, 2026
@github-actions github-actions Bot added the feature New feature or enhancement label Sep 9, 2026
@asteiner-swisstopo asteiner-swisstopo changed the title PB-1677: sort extension - Add properties prefix PB-1677: sort extension - Add properties prefix #minor Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or enhancement WIP 🚧 Work in progress: workflow will prevent merging a PR with this label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant