diff --git a/airbyte_cdk/sources/utils/transform.py b/airbyte_cdk/sources/utils/transform.py index b9348d3ed..dffd0b798 100644 --- a/airbyte_cdk/sources/utils/transform.py +++ b/airbyte_cdk/sources/utils/transform.py @@ -3,20 +3,11 @@ # import logging -from copy import deepcopy from enum import Flag, auto -from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, Mapping, Optional, cast +from typing import Any, Callable, Dict, Generator, Mapping, Optional, cast from jsonschema import Draft7Validator, ValidationError, validators from jsonschema.protocols import Validator -from referencing import Registry, Resource -from referencing._core import Resolver -from referencing.exceptions import Unresolvable -from referencing.jsonschema import DRAFT7 - -from airbyte_cdk.sources.utils.schema_helpers import expand_refs - -from .schema_helpers import get_ref_resolver_registry MAX_NESTING_DEPTH = 3 json_to_python_simple = { @@ -201,15 +192,6 @@ def normalizator( validators parameter for detailed description. : """ - # Very first step is to expand $refs in the schema itself: - expand_refs(schema) - - # Now we can expand $refs in the property value: - if isinstance(property_value, dict): - expand_refs(property_value) - - # Now we can validate and normalize the values: - # Transform object and array values before running json schema type checking for each element. # Recursively normalize every value of the "instance" sub-object, # if "instance" is an incorrect type - skip recursive normalization of "instance" diff --git a/unit_tests/sources/utils/test_transform.py b/unit_tests/sources/utils/test_transform.py index 17d86b1c7..8c580a953 100644 --- a/unit_tests/sources/utils/test_transform.py +++ b/unit_tests/sources/utils/test_transform.py @@ -18,24 +18,13 @@ "number_prop": {"type": "number"}, "int_prop": {"type": ["integer", "null"]}, "too_many_types": {"type": ["boolean", "null", "string"]}, - "def": { - "type": "object", - "properties": { - "dd": {"$ref": "#/definitions/my_type"}, - }, - }, - "array": {"type": "array", "items": {"$ref": "#/definitions/str_type"}}, - "nested": {"$ref": "#/definitions/nested_type"}, + "array": {"type": "array", "items": {"type": "string"}}, + "nested": {"type": "object", "properties": {"a": {"type": "string"}}}, "list_of_lists": { "type": "array", "items": {"type": "array", "items": {"type": "string"}}, }, }, - "definitions": { - "str_type": {"type": "string"}, - "my_type": {"type": "string"}, - "nested_type": {"type": "object", "properties": {"a": {"type": "string"}}}, - }, } VERY_NESTED_SCHEMA = { "type": ["null", "object"],