Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
list: "array",
dict: "object",
set: "array",
frozenset: "array",
tuple: "array",
"int": "integer",
"str": "string",
Expand All @@ -25,6 +26,7 @@
"list": "array",
"dict": "object",
"set": "array",
"frozenset": "array",
"tuple": "array",
"object": "object",
"array": "array",
Expand Down Expand Up @@ -182,7 +184,7 @@ def handle_complex_type(
args = get_args(parameter_type)

schema: dict[str, Any] = {}
if origin is list or origin is set:
if origin in (list, set, frozenset):
item_type = args[0]
schema = {
"type": "array",
Expand Down
7 changes: 7 additions & 0 deletions python/tests/unit/schema/test_schema_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@ def test_build_set():
assert schema == {"type": "array", "items": {"type": "integer"}}


def test_build_frozenset():
schema = KernelJsonSchemaBuilder.build(frozenset[int])
assert schema == {"type": "array", "items": {"type": "integer"}}
assert KernelJsonSchemaBuilder.build(frozenset) == {"type": "array"}
assert KernelJsonSchemaBuilder.build("frozenset") == {"type": "array"}


def test_build_tuple():
schema = KernelJsonSchemaBuilder.build(tuple[int, str])
assert schema == {
Expand Down
Loading