Skip to content
Merged
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
5 changes: 4 additions & 1 deletion midcli/command/generic_call/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ def _process_method(self, method):
def _create_arguments(self):
for i, item in enumerate(self.method["accepts"] or []):
if i == self.splice_kwargs:
if "anyOf" in item and all(option.get("type") == "object" for option in item["anyOf"]):
# Handle discriminated unions (oneOf with discriminator) and anyOf unions
if ("anyOf" in item or "oneOf" in item) and all(
option.get("type") == "object" for option in item.get("anyOf") or item.get("oneOf")
):
# FIXME: Remove this when we use proper field discriminators in API
item = {"type": "object", "_attrs_order_": []}

Expand Down
4 changes: 3 additions & 1 deletion midcli/gui/base/steps/input_delegate.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ def create_input_delegate(input: "Input", schema: dict) -> "InputDelegate":
type.add("null")
elif isinstance(v, str):
type.add("string")
elif "anyOf" in schema and (type := {s["type"] for s in schema["anyOf"]}):
elif ("anyOf" in schema or "oneOf" in schema) and (
type := {s["type"] for s in schema.get("anyOf", []) or schema.get("oneOf", [])}
):
pass
else:
raise ValueError(f"Unable to create input delegate for schema {schema!r}")
Expand Down