From 386bfb1c6ce4c1c5e5a8e557de86b8216784fa2c Mon Sep 17 00:00:00 2001 From: almog8k Date: Mon, 29 Dec 2025 09:26:11 +0200 Subject: [PATCH 1/2] feat: add product schema --- src/schemas/ingestion/index.ts | 1 + src/schemas/ingestion/product.schema.ts | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 src/schemas/ingestion/product.schema.ts diff --git a/src/schemas/ingestion/index.ts b/src/schemas/ingestion/index.ts index 18d408c..0efefdb 100644 --- a/src/schemas/ingestion/index.ts +++ b/src/schemas/ingestion/index.ts @@ -7,3 +7,4 @@ export * from './task.schema'; export * from './layerNameFormats.schema'; export * from './callback.schema'; export * from './validationTask.schema'; +export * from './product.schema'; diff --git a/src/schemas/ingestion/product.schema.ts b/src/schemas/ingestion/product.schema.ts new file mode 100644 index 0000000..215eca0 --- /dev/null +++ b/src/schemas/ingestion/product.schema.ts @@ -0,0 +1,7 @@ +import z from 'zod'; +import { featureSchema, multiPolygonSchema, polygonSchema } from '../core'; + +export const productFeatureSchema = featureSchema(z.union([polygonSchema, multiPolygonSchema]), z.object({}).passthrough()) + .array() + .length(1, 'product shapefile must contain a single feature') + .transform((features) => features[0]); From 2574bcd364710729399c2856328146ee9093b9f9 Mon Sep 17 00:00:00 2001 From: almog8k Date: Mon, 29 Dec 2025 09:26:50 +0200 Subject: [PATCH 2/2] refactor: update export input parameters to use previous callbackUrlsArraySchema --- src/schemas/export/job.schema.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/schemas/export/job.schema.ts b/src/schemas/export/job.schema.ts index f37ba63..b142602 100644 --- a/src/schemas/export/job.schema.ts +++ b/src/schemas/export/job.schema.ts @@ -1,13 +1,18 @@ import { z } from 'zod'; import { CORE_VALIDATIONS, TileFormatStrategy, TileOutputFormat } from '../../constants'; import { polygonPartsEntityNameSchema } from '../ingestion'; -import { urlsArraySchema } from '../core'; import { callbackExportResponseSchema, cleanupDataSchema, roiFeatureCollectionSchema, fileNamesTemplatesSchema } from './export.schema'; +export const callbackUrlSchema = z.object({ + url: z.string().url(), +}); + +export const callbackUrlsArraySchema = z.array(callbackUrlSchema); // TODO: remove when all services use the same callback schema( currently ingestion uses urlsArraySchema and export uses callbackUrlSchema) + export const exportInputParamsSchema = z.object({ crs: z.string(z.literal('EPSG:4326')), roi: roiFeatureCollectionSchema, - callbackUrls: urlsArraySchema.optional(), + callbackUrls: callbackUrlsArraySchema.optional(), }); export const exportAdditionalParamsSchema = z