Skip to content

Conversation

@vincentsarago
Copy link
Collaborator

@vincentsarago vincentsarago commented Jan 15, 2026

Description

This PR should fixe the pagination issue with new PgSTAC database. I choose not to update to stac-fastapi 6.0 and stac-fastapi-pgstac 6.0 to keep the change manageable.

Fixes #274

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Checklist:

Please delete options that are not relevant.

  • I have performed a self-review
  • Changelog has been updated
  • Documentation has been updated
  • Unit tests pass locally (./scripts/test)
  • Code is linted and styled (./scripts/format)

@abstractmethod
def mask(self: T, geom: Dict[str, Any]) -> T: ...
def mask(self: T, geom: Dict[str, Any]) -> T:
...
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format change unrelated to the PR goal

@abstractmethod
async def get_mosaic(self, tiles: List[Tile]) -> T: ...
async def get_mosaic(self, tiles: List[Tile]) -> T:
...
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format change unrelated to the PR goal

and "collection=" not in str(request.url)
and '{"property":"collection"}'
not in orjson.dumps(search_request.filter).decode("utf-8")
not in orjson.dumps(search_request.filter_expr).decode("utf-8")
Copy link
Collaborator Author

@vincentsarago vincentsarago Jan 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed filter to filter_expr input attributes in GET endpoint methods

ref: https://github.com/stac-utils/stac-fastapi-pgstac/blob/main/CHANGES.md#400---2025-02-03

description=API_DESCRIPTION,
extra_conformance_classes=extra_conformance_classes,
post_request_model=post_request_model,
pgstac_search_model=post_request_model,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed post_request_model attribute to pgstac_search_model in CoreCrudClient class

ref: https://github.com/stac-utils/stac-fastapi-pgstac/blob/main/CHANGES.md#400---2025-02-03

conformance_classes=[
FilterConformanceClasses.FILTER,
FilterConformanceClasses.ITEM_SEARCH_FILTER,
FilterConformanceClasses.SEARCH,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed filter.FilterConformanceClasses.ITEM_SEARCH_FILTER -> filter.FilterConformanceClasses.SEARCH

ref: renamed filter.FilterConformanceClasses.ITEM_SEARCH_FILTER -> filter.FilterConformanceClasses.SEARCH

app.root_path, schema, tag=f"STAC API {STAC_API_VERSION}"
)
app.openapi_schema = fixed_schema
return fixed_schema
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is maybe the biggest change with this PR that doesn't seem well tested in tests

@vincentsarago vincentsarago force-pushed the pcstac/feature/update-stac-fastapi-5.0 branch from a4cc457 to 1b76532 Compare January 15, 2026 23:18
@vincentsarago
Copy link
Collaborator Author

vincentsarago commented Jan 15, 2026

not sure what's going on and why stac-api-validator is failing.

the error message is - [Collections] /collections self link does not match requested url

but locally when I run the service and change the /collections links I get the correct url 🤷

curl http://localhost:8080/stac/collections | jq '.links' 

[
  {
    "rel": "root",
    "type": "application/json",
    "href": "http://localhost:8080/stac/"
  },
  {
    "rel": "self",
    "type": "application/json",
    "href": "http://localhost:8080/stac/collections"
  }
]

Using Stac-check also ✅

stac-check  http://localhost:8080/stac/collections --collections

________________________________________________________
 ____  ____  __    ___       ___  _  _  ____  ___  __ _ 
/ ___)(_  _)/ _\  / __)___  / __)/ )( \(  __)/ __)(  / )
\___ \  )( /    \( (__(___)( (__ ) __ ( ) _)( (__  )  ( 
(____/ (__)\_/\_/ \___)     \___)\_)(_/(____)\___)(__\_)
________________________________________________________
    
stac-check: STAC spec validation and linting tool

Please upgrade to STAC version 1.1.0!

 Validator: stac-validator 3.10.1

 Validation method: JSONSchema


Collections: Validate all collections in a STAC API
Pages = 1
-------------------------

 Asset 1: http://localhost:8080/stac/collections/naip

COLLECTION Passed: True

Schemas checked: 
    https://stac-extensions.github.io/item-assets/v1.0.0/schema.json
    https://schemas.stacspec.org/v1.0.0/collection-spec/json-schema/collection.json



 STAC Best Practices: 

Links in catalogs and collections should always have a 'title' field


 Additional Information: 

This object has 7 links

Disclaimer: Schema-based STAC validation may be incomplete and should only be considered as a first indicator of validity.
See: https://github.com/radiantearth/stac-spec/discussions/1242

-------------------------

 Validation Summary

✅ Passed: 1/1

⚠️  Best Practice Warnings (1 assets)

  http://localhost:8080/stac/collections/naip:
    • Links in catalogs and collections should always have a 'title' field

🔍 All 1 Assets Checked
  - http://localhost:8080/stac/collections/naip

@ghidalgo3 ghidalgo3 merged commit d79b0e3 into main Jan 16, 2026
6 checks passed
@ghidalgo3 ghidalgo3 deleted the pcstac/feature/update-stac-fastapi-5.0 branch January 16, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pagination links are missing from STAC API responses

3 participants