From 895e27ddf1e42e792914e8432779c77a2dc3c533 Mon Sep 17 00:00:00 2001 From: Solomon Negusse Date: Tue, 27 Aug 2024 13:06:07 +0300 Subject: [PATCH 1/3] return error on date validation error --- app/models/pydantic/metadata.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/pydantic/metadata.py b/app/models/pydantic/metadata.py index e63af4f39..0c71b5451 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 @@ -182,4 +183,6 @@ def _date_validator(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" + ) From c56761079ace400ff000a6e6b262fe677ed73adf Mon Sep 17 00:00:00 2001 From: Daniel Mannarino Date: Tue, 27 Aug 2024 10:48:01 -0400 Subject: [PATCH 2/3] Restore behaviour of naming VTC layers after dataset --- batch/scripts/create_vector_tile_cache.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/batch/scripts/create_vector_tile_cache.sh b/batch/scripts/create_vector_tile_cache.sh index 5c8d87ca4..6a250834d 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 From 0064218a61387931a8961258573d88b8c16911ec Mon Sep 17 00:00:00 2001 From: Solomon Negusse Date: Tue, 27 Aug 2024 19:54:15 +0300 Subject: [PATCH 3/3] pass through None in validation --- app/models/pydantic/metadata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/pydantic/metadata.py b/app/models/pydantic/metadata.py index 0c71b5451..f17d44b6d 100644 --- a/app/models/pydantic/metadata.py +++ b/app/models/pydantic/metadata.py @@ -177,7 +177,7 @@ 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: