Skip to content

Commit

Permalink
Fix detection of UUID param
Browse files Browse the repository at this point in the history
  • Loading branch information
dmannarino committed Jan 17, 2025
1 parent 2707a21 commit a1da0c0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/routes/geostore/geostore.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Retrieve a geometry using its md5 hash for a given dataset, user defined
geometries in the datastore."""
from typing import Annotated, Dict
from uuid import UUID

from fastapi import APIRouter, Header, HTTPException, Path
from fastapi.responses import ORJSONResponse
from pydantic.types import UUID4

from ...crud import geostore
from ...errors import BadRequestError, RecordNotFoundError
Expand Down Expand Up @@ -94,13 +94,13 @@ async def rw_get_view_geostore_by_id(
)
async def get_any_geostore(
*,
geostore_id: UUID4 | str = Path(..., title="geostore_id"),
geostore_id: UUID | str = Path(..., title="geostore_id"),
x_api_key: Annotated[str | None, Header()] = None,
):
"""Retrieve GeoJSON representation for a given geostore ID of any
dataset."""
# If provided geostore ID follows UUID4 style, it's meant for GFW Data API
if isinstance(geostore_id, UUID4):
# If provided geostore ID follows UUID style, it's meant for GFW Data API
if isinstance(geostore_id, UUID):
try:
result = await geostore.get_gfw_geostore_from_any_dataset(geostore_id)
return GeostoreResponse(data=result)
Expand Down

0 comments on commit a1da0c0

Please sign in to comment.