stac-fastapi
stac-fastapi copied to clipboard
PUT "/collections/{collection_id}" throws "update_collection() missing 1 required positional argument: 'collection'"
#630 fixed the update collection REST endpoint in the "transactions" extension, to properly include the collection's id in /collections/{collection_id}
. Nice.
However, when the endpoint is registered it still only expects a Collection in the JSON payload, without defining the new URL segment. This makes the first update_collection
argument collection_id
being passed the full JSON payload, and makes collection
being empty.
This throws update_collection() missing 1 required positional argument: 'collection'
.
I'll create a PR with a fix.
Hi @avbentem. Thanks for this. What stac-fastapi backend are you using?
Hi @jonhealy1 sorry for only seeing your question today. I'm not actually using any backend yet. (I'll likely use a bespoke one, combing Google cloud storage with PostGIS.) But I ran into this bug when setting up a basic project structure, that basically only implements the abstract methods to print the requests. (Kind of like in the tests I added.)
Wondering why you're asking. Do you think that some of the stac-utils
provided backends (like stac-fastapi-pgstac or stac-fastapi-sqlalchemy) would not suffer from this bug? If that would be the case then I'd guess that those backends are not using the abstract classes that this very stac-fastapi
provides?
Ok thanks for the clarification. stac-fastapi-pgstac and stac-fastapi-elasticsearch-opensearch seem to be fine. You may be right - something to look into.