Open frehburg opened 3 weeks ago
Hi @frehburg the oneof Protobuf field represents a field where one of several values may be stored. A TimeElement is a nice example of this in the context of Phenopacket Schema.
In Python, a oneof field where, e.g. str
and pathlib.Path
are the possible values is probably best represented as typing.Union[str, pathlib.Path]
.
Regarding ideas - using Unions as input argument type provides convenience. However, union as a return type is a bit annoying because the user code is forced to do instance check before doing anything useful.
Perhaps we may have a Union node in our data model hierarchy, and have the node implement the node requirements?
@ielis i noticed that there are or groups in the phenopacket schema. E.g.: GenomicInterpretation.call. I am unsure of how to resolve them in a DataModel when loading data from a file.
Do you have any ideas?