Skip to content

Commit d71cc3f

Browse files
Update jsonref to a fairly recent version
1 parent 406542d commit d71cc3f

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

airbyte_cdk/sources/utils/schema_helpers.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ def resolve_ref_links(obj: Any) -> Any:
4747
:return JSON serializable object with references without external dependencies.
4848
"""
4949
if isinstance(obj, jsonref.JsonRef):
50-
obj = resolve_ref_links(obj.__subject__)
50+
# In jsonref 1.1.0, JsonRef objects act as proxies to their underlying objects
51+
# We can directly convert them to dict instead of accessing ._subject
52+
obj_dict = dict(obj)
53+
obj = resolve_ref_links(obj_dict)
5154
# Omit existing definitions for external resource since
5255
# we dont need it anymore.
5356
if isinstance(obj, dict):
@@ -155,7 +158,7 @@ def _resolve_schema_references(self, raw_schema: dict[str, Any]) -> dict[str, An
155158
base = os.path.dirname(package.__file__) + "/"
156159
else:
157160
raise ValueError(f"Package {package} does not have a valid __file__ field")
158-
resolved = jsonref.JsonRef.replace_refs(
161+
resolved = jsonref.replace_refs(
159162
raw_schema, loader=JsonFileLoader(base, "schemas/shared"), base_uri=base
160163
)
161164
resolved = resolve_ref_links(resolved)

poetry.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ dunamai = "^1.22.0"
3838
genson = "1.3.0"
3939
isodate = "~0.6.1"
4040
Jinja2 = "~3.1.2"
41-
jsonref = "~0.2"
41+
jsonref = "^1.1.0"
4242
jsonschema = "~4.17.3" # 4.18 has some significant breaking changes: https://github.com/python-jsonschema/jsonschema/releases/tag/v4.18.0
4343
pandas = "2.2.2"
4444
psutil = "6.1.0"

unit_tests/sources/utils/test_schema_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def test_shared_schemas_resolves_nested():
194194
assert actual_schema == expected_schema
195195
# Make sure generated schema is JSON serializable
196196
assert json.dumps(actual_schema)
197-
assert jsonref.JsonRef.replace_refs(actual_schema)
197+
assert jsonref.replace_refs(actual_schema)
198198

199199

200200
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)