Skip to content

Commit bd91a96

Browse files
author
Codemation
committed
Added support for typer.Option default value in function signatures, now correctly extracts default value for signature sent to proxies
1 parent 5f2736d commit bd91a96

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

easyrpc/sigtools.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def encode_json_value(v: Any) -> dict:
3434
if not all(isinstance(k, str) for k in v):
3535
raise TypeError("Only dict defaults/metadata with string keys are supported")
3636
return {"k": "dict", "v": {k: encode_json_value(x) for k, x in v.items()}}
37+
# adds support for typer.Option default values, which are not JSON serializable but have a .default
38+
if hasattr(v, 'default'):
39+
return {"k": "prim", "v": v.default}
3740
raise TypeError(f"Value is not supported by this JSON codec: {v!r}")
3841

3942

0 commit comments

Comments
 (0)