You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I noticed that in version 1.3, the help method converts Python objects into a JSON structure. However, the current implementation prevents the use of UnionType in action definitions, which makes the args unable to be optional.
I looked at the code, and the main reason for this is:
You mean individual optional arguments? Yeah those are not supported yet. It's only because I haven't gotten to it.
The API currently assumes all method args are required and are plain JSON serializable types like (dict, list, string, ...). I should add that to the documentation I think.
This wasn't so much a design decision but just that I haven't explored it yet. I will tinker with this to see how the API can be adjusted to allow optional args.
Yes, because after Python 3.10, the optional type is a special case of the union type, which can be written as int | None. In many scenarios, this is convenient for code reuse. However, what may need to be considered here is whether the action tends to be designed as a function with a single responsibility, which is also the reason I'm asking if it is a design decision.
operand
changed the title
The args of "action" cannot be optional after version 1.3
Optional args
Aug 11, 2023
Hello, I noticed that in version 1.3, the
help
method converts Python objects into a JSON structure. However, the current implementation prevents the use ofUnionType
in action definitions, which makes the args unable to be optional.I looked at the code, and the main reason for this is:
When the argument type is a
UnionType
,sig_annotation
does not have the__name__
attribute.Is this a design decision?
The text was updated successfully, but these errors were encountered: