Skip to content
Open
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
6 changes: 4 additions & 2 deletions src/taskgraph/util/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import re
from collections.abc import Mapping
from functools import reduce
from typing import Literal, Optional, Union
from typing import Any, Literal, Optional, Union

import msgspec
import voluptuous
Expand Down Expand Up @@ -79,9 +79,11 @@ def optionally_keyed_by(*arguments, use_msgspec=False):
if use_msgspec:
# msgspec implementation - return type hints
_type = arguments[-1]
if _type is object:
return object
fields = arguments[:-1]
bykeys = [Literal[f"by-{field}"] for field in fields]
return Union[_type, dict[UnionTypes(*bykeys), dict[str, _type]]]
return Union[_type, dict[UnionTypes(*bykeys), dict[str, Any]]]
else:
# voluptuous implementation - return validator function
schema = arguments[-1]
Expand Down
Loading