Skip to content

Commit

Permalink
[components][fix] Fix issue with additional scope determination
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenKephart committed Jan 11, 2025
1 parent 7488996 commit 34d6a92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ def _subschemas_on_path(
# List[ComplexType] (e.g.) will contain a reference to the complex type schema in the
# top-level $defs, so we dereference it here.
if "$ref" in subschema:
subschema = json_schema["$defs"].get(subschema["$ref"][len(REF_BASE) :])
# depending on the pydantic version, the extras may be stored with the reference or not
extras = {k: v for k, v in subschema.items() if k != "$ref"}
subschema = {**json_schema["$defs"].get(subschema["$ref"][len(REF_BASE) :]), **extras}

yield subschema
if len(valpath) == 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def test_allow_render(path, expected: bool) -> None:
(["inner_seq"], set()),
(["container_optional_scoped"], {"a", "b"}),
(["container_optional_scoped", "inner"], {"a", "b"}),
# (["container_optional_scoped", "inner_scoped"], {"a", "b", "c", "d"}),
# (["container_optional_scoped", "inner_scoped", "a"], {"a", "b", "c", "d"}),
(["container_optional_scoped", "inner_scoped"], {"a", "b", "c", "d"}),
(["container_optional_scoped", "inner_scoped", "a"], {"a", "b", "c", "d"}),
],
)
def test_get_available_scope(path, expected: Set[str]) -> None:
Expand Down

0 comments on commit 34d6a92

Please sign in to comment.