diff --git a/iohub/ngff/models.py b/iohub/ngff/models.py index d94fb5dc..00ed964c 100644 --- a/iohub/ngff/models.py +++ b/iohub/ngff/models.py @@ -17,6 +17,7 @@ AfterValidator, BaseModel, ConfigDict, + Discriminator, Field, NonNegativeInt, PositiveInt, @@ -168,13 +169,11 @@ class TimeAxisMeta(NamedAxisMeta): ) -class NonstandardAxisMeta(NamedAxisMeta): - type: str | None - unit: str | None - - """https://ngff.openmicroscopy.org/0.4/index.html#axes-md""" -AxisMeta = TimeAxisMeta | ChannelAxisMeta | SpaceAxisMeta | NonstandardAxisMeta +AxisMeta = Annotated[ + TimeAxisMeta | ChannelAxisMeta | SpaceAxisMeta, + Discriminator("type"), +] class TransformationMeta(MetaBase): @@ -227,7 +226,7 @@ class MultiScaleMeta(VersionMeta): """https://ngff.openmicroscopy.org/0.4/index.html#multiscale-md""" # MUST - axes: list[AxisMeta] = Field(..., discriminator="type") + axes: list[AxisMeta] # MUST datasets: list[DatasetMeta] # SHOULD