microscopic-furniture-57275
05/12/2023, 4:00 AMtyping.Union
type for a field, e.g. my_param: Union[int,list[int]]=field(default_factory=list)
, Flyte complains like so:
# "Failed to extract schema for object <class 'plaster.run.sim_v3.sim_v3_params.SimV3Params'>, (will run schemaless) error: unsupported field type <fields._UnionField(dump_default=<class 'list'>, attribute=None, validate=None, required=False, load_only=False, dump_only=False, load_default=<marshmallow.missing>, allow_none=False, error_messages={'required': 'Missing data for required field.', 'null': 'Field may not be null.', 'validator_failed': 'Invalid value.'})>If you have postponed annotations turned on (PEP 563) turn it off please. Postponedevaluation doesn't work with json dataclasses"
I am not using postponed annotations in this case.
The reason for my use of Union is trying to migrate the schema of a dataclass member from int to list[int]. I need to support loading older jobs, so thought the Union was an expedient solution, allowing me to init the dataclass with either an int (older jobs) or a list[int] (new jobs).
I am on python 3.9 - I mention this because I seem to recall reading something related (maybe this issue?) that goes away beyond 3.9, but maybe I'm thinking of the "futures" issue related to postponed evaluations.
Thanks!
Thomasglamorous-carpet-83516
05/12/2023, 5:29 AMmicroscopic-furniture-57275
05/12/2023, 2:01 PM