diff --git a/app/models/pydantic/metadata.py b/app/models/pydantic/metadata.py index e63af4f3..f17d44b6 100644 --- a/app/models/pydantic/metadata.py +++ b/app/models/pydantic/metadata.py @@ -2,6 +2,7 @@ from typing import Any, List, Optional, Union from uuid import UUID +from fastapi import HTTPException from pydantic import Field, validator, BaseModel from pydantic.utils import GetterDict @@ -176,10 +177,12 @@ class VersionMetadataWithParentResponse(Response): def _date_validator(date_str): - if isinstance(date_str, date): + if isinstance(date_str, date) or date_str is None: return date_str try: return datetime.strptime(date_str, "%Y-%m-%d").date() except (ValueError, TypeError): - return None + raise HTTPException( + status_code=422, detail="Date needs to be of the format YYYY-MM-DD" + ) diff --git a/batch/scripts/create_vector_tile_cache.sh b/batch/scripts/create_vector_tile_cache.sh index 5c8d87ca..6a250834 100755 --- a/batch/scripts/create_vector_tile_cache.sh +++ b/batch/scripts/create_vector_tile_cache.sh @@ -18,7 +18,7 @@ ME=$(basename "$0") . get_arguments.sh "$@" -NDJSON_FILE="data.json" +NDJSON_FILE="${DATASET}.json" # Build an array of arguments to pass to tippecanoe TIPPE_ARG_ARRAY=( @@ -28,6 +28,7 @@ TIPPE_ARG_ARRAY=( "--preserve-input-order" "-P" "-n" "${DATASET}" + "-l" "${DATASET}" ) case ${TILE_STRATEGY} in