Skip to content

Commit

Permalink
revert to post_request_model
Browse files Browse the repository at this point in the history
  • Loading branch information
hrodmn committed Aug 2, 2024
1 parent 0e586dd commit e5c5c40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
5 changes: 3 additions & 2 deletions stac_fastapi/pgstac/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@
else:
collections_get_request_model = EmptyRequest

post_request_model = create_post_request_model(extensions, base_model=PgstacSearch)
post_request_model = create_post_request_model(
extensions + collection_extensions, base_model=PgstacSearch
)
get_request_model = create_get_request_model(extensions + collection_extensions)

api = StacApi(
Expand All @@ -96,7 +98,6 @@
items_get_request_model=items_get_request_model,
search_get_request_model=get_request_model,
search_post_request_model=post_request_model,
collections_get_request_model=collections_get_request_model,
)
app = api.app

Expand Down
10 changes: 1 addition & 9 deletions stac_fastapi/pgstac/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
from pygeofilter.parsers.cql2_text import parse as parse_cql2_text
from pypgstac.hydration import hydrate
from stac_fastapi.api.models import JSONResponse
from stac_fastapi.extensions.core.collection_search.request import (
BaseCollectionSearchPostRequest,
)
from stac_fastapi.types.core import AsyncBaseCoreClient, Relations
from stac_fastapi.types.errors import InvalidQueryParameter, NotFoundError
from stac_fastapi.types.requests import get_base_url
Expand All @@ -41,10 +38,6 @@
class CoreCrudClient(AsyncBaseCoreClient):
"""Client for core endpoints defined by stac."""

collections_post_request_model: BaseCollectionSearchPostRequest = attr.ib(
default=BaseCollectionSearchPostRequest
)

async def all_collections( # noqa: C901
self,
request: Request,
Expand Down Expand Up @@ -88,8 +81,7 @@ async def all_collections( # noqa: C901

# Do the request
try:
search_request = self.collections_post_request_model(**clean)
# search_request = self.post_request_model(**clean)
search_request = self.post_request_model(**clean)
except ValidationError as e:
raise HTTPException(
status_code=400, detail=f"Invalid parameters provided {e}"
Expand Down

0 comments on commit e5c5c40

Please sign in to comment.