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
{{ message }}
Repository navigation
GenConverter unstructures tuple to list if in union type. #214
I see. I am fine with tuples always being structured into lists. And now that I think about it, I see your point with favoring list instead of tuple.
Perhaps the real issue is that the behavior is inconsistent.
When Tuple is unstructured directly we get tuple, but Tuple inside Optional we get list. And it is not the nesting that causes this (Tuple inside of List generates tuple), it is only inside Union (or Optional).
I dont see any reason for this behavior. Naturally I would expect that if I put Optional around something I get the same unstructuring behavior. The difference would just be that None is also allowed. But that does not make much of a difference for unstructuring as it does not validate either.
Activity
Tinche commentedon Jan 26, 2022
I don't think it'd be too difficult to fix, but why is it a problem?
The code essentially boils down to:
Lists are better as the default here because:
Tinche commentedon Jan 26, 2022
As a small tip, if you really need them to stay tuples:
aha79 commentedon Jan 27, 2022
I see. I am fine with tuples always being structured into lists. And now that I think about it, I see your point with favoring list instead of tuple.
Perhaps the real issue is that the behavior is inconsistent.
When Tuple is unstructured directly we get
tuple, but Tuple inside Optional we getlist. And it is not the nesting that causes this (Tuple inside of List generates tuple), it is only inside Union (or Optional).I dont see any reason for this behavior. Naturally I would expect that if I put Optional around something I get the same unstructuring behavior. The difference would just be that None is also allowed. But that does not make much of a difference for unstructuring as it does not validate either.
Tinche commentedon Jan 27, 2022
Hm I think you're right in that our
Optionalhandling is inconsistent. I can add a test for this.bibajz commentedon Feb 10, 2022
Hi, this issue is also fixed by #227 - both cases are now unstructured to
list