Skip to content

Commit b22801c

Browse files
Update jsonref to a fairly recent version
# Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Author: Johann-Peter Hartmann <[email protected]> # # interactive rebase in progress; onto 651f07f # Last command done (1 command done): # pick d71cc3f Update jsonref to a fairly recent version # Next command to do (1 remaining command): # pick 327131b fix: Replace Unidecode with anyascii for permissive license (airbytehq#367) # You are currently rebasing branch 'main' on '651f07f9'. # # Changes to be committed: # modified: airbyte_cdk/sources/utils/schema_helpers.py # modified: poetry.lock # modified: pyproject.toml # modified: unit_tests/sources/utils/test_schema_helpers.py #
1 parent 651f07f commit b22801c

File tree

4 files changed

+873
-814
lines changed

4 files changed

+873
-814
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)

0 commit comments

Comments
 (0)