diff --git a/airbyte_cdk/utils/schema_inferrer.py b/airbyte_cdk/utils/schema_inferrer.py index f3c6b2fae..b49fb637a 100644 --- a/airbyte_cdk/utils/schema_inferrer.py +++ b/airbyte_cdk/utils/schema_inferrer.py @@ -120,7 +120,7 @@ def _clean_any_of(self, node: InferredSchema) -> None: node[_TYPE] = [node[_TYPE], _NULL_TYPE] node.pop(_ANY_OF) # populate `type` for `anyOf` if it's not present to pass all other checks - elif len(node[_ANY_OF]) == 2 and not self._null_type_in_any_of(node): + elif len(node[_ANY_OF]) > 1: node[_TYPE] = [_NULL_TYPE] def _clean_properties(self, node: InferredSchema) -> None: diff --git a/unit_tests/utils/test_schema_inferrer.py b/unit_tests/utils/test_schema_inferrer.py index 2c8813699..078207c6b 100644 --- a/unit_tests/utils/test_schema_inferrer.py +++ b/unit_tests/utils/test_schema_inferrer.py @@ -228,6 +228,7 @@ "nested_key_2": "United Kingdom", }, }, + {"title": "Nested_3", "type": "string", "value": "XL"}, ], } }, @@ -247,6 +248,7 @@ "type": {"type": ["string", "null"]}, "value": { "anyOf": [ + {"type": "string"}, {"type": "array", "items": {"type": "string"}}, { "type": "object",