Skip to content

Commit 9dbf2f2

Browse files
committed
update to ignore on key error
1 parent 99a1a96 commit 9dbf2f2

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

airbyte_cdk/sources/declarative/validators/dpath_validator.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
#
44

55
from dataclasses import dataclass
6-
from typing import Any, List, Union
6+
from typing import Any, List
77

88
import dpath.util
99

1010
from airbyte_cdk.sources.declarative.interpolation.interpolated_string import InterpolatedString
1111
from airbyte_cdk.sources.declarative.validators.validation_strategy import ValidationStrategy
1212
from airbyte_cdk.sources.declarative.validators.validator import Validator
1313

14-
1514
@dataclass
1615
class DpathValidator(Validator):
1716
"""
@@ -47,17 +46,13 @@ def validate(self, input_data: dict[str, Any]) -> None:
4746
if "*" in path:
4847
try:
4948
values = dpath.values(input_data, path)
50-
if not values:
51-
return
5249
for value in values:
5350
self.strategy.validate(value)
5451
except KeyError as e:
55-
raise ValueError(f"Error validating path '{self.field_path}': {e}")
52+
return
5653
else:
5754
try:
5855
value = dpath.get(input_data, path)
59-
if not value:
60-
return
6156
self.strategy.validate(value)
6257
except KeyError as e:
63-
raise ValueError(f"Error validating path '{self.field_path}': {e}")
58+
return

0 commit comments

Comments
 (0)