`minos.common.Field` must accept `tuple` type
Issue by garciparedes
Monday May 10, 2021 at 13:09 GMT
Originally opened as https://github.com/Clariteia/minos_microservice_common/issues/193
The current MinosModel field typing is not compatible with the tuple type, which causes a big modelling issue in cases in which it's needed to define an unnamed type validation, such us tuple[str, int float] (the fields must have str, int and float types respectively.
Currently, there is a workaround to obtain a similar behaviour, combining the list + Union operators and writing as list[Union[str, int, float] but the obtained result is not strictly the same, because in this case there is not any ordering constraint nor any sequence-length constraint. In this case a [3, "foo", 4.35] is a valid value, but also a ["foo"] and [] are also fine according to that typing, so that it could carry future type checking errors or misconceptions.
For the above causes, I propose to extend the MinosModel type compatibility including the tuple.
┆Issue is synchronized with this ClickUp task by Unito
Comment by garciparedes
Friday Oct 08, 2021 at 07:48 GMT
Here is an explanation about how the tuple type hints must work: https://docs.python.org/3/library/typing.html#typing.Tuple
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.