From 928ad331115cd5057b5d32560d9c2c82ffe606c8 Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Thu, 23 Jan 2025 21:09:53 -0300 Subject: [PATCH] feat(import): move required field check to end of process --- app/apps/import_app/services/v1.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/apps/import_app/services/v1.py b/app/apps/import_app/services/v1.py index e19886b..a992630 100644 --- a/app/apps/import_app/services/v1.py +++ b/app/apps/import_app/services/v1.py @@ -406,15 +406,15 @@ class ImportService: if value is None: value = mapping.default - if mapping.required and value is None and not mapping.transformations: - raise ValueError(f"Required field {field} is missing") - # Apply transformations if mapping.transformations: value = self._transform_value(value, mapping, row) value = self._coerce_type(value, mapping) + if mapping.required and value is None: + raise ValueError(f"Required field {field} is missing") + if value is not None: # Remove the prefix from the target field target = mapping.target