Skip to content

Commit

Permalink
Use JsonValue for unknown types
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby committed Dec 10, 2024
1 parent 9446dca commit 434a405
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/ome_zarr_models/v04/_bioformats2raw.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any, Literal
from typing import Literal

from pydantic import Field
from pydantic import Field, JsonValue

from ome_zarr_models.base import Base
from ome_zarr_models.v04.plate import Plate
Expand All @@ -13,4 +13,4 @@ class BioFormats2RawAttrs(Base):

bioformats2raw_layout: Literal[3] = Field(..., alias="bioformats2raw.layout")
plate: Plate | None = None
series: Any | None = None
series: JsonValue | None = None
6 changes: 4 additions & 2 deletions src/ome_zarr_models/v04/axes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from collections.abc import Sequence
from typing import Any, Literal
from typing import Literal

from pydantic import JsonValue

from ome_zarr_models.base import Base

Expand All @@ -18,7 +20,7 @@ class Axis(Base):

name: str
type: str | None = None
unit: str | Any | None = None
unit: str | JsonValue | None = None


Axes = Sequence[Axis]
12 changes: 6 additions & 6 deletions src/ome_zarr_models/v04/multiscales.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

from collections import Counter
from collections.abc import Sequence
from typing import Annotated, Any, Self, get_args
from typing import Annotated, Literal, Self, get_args

from pydantic import AfterValidator, Field, model_validator
from pydantic import AfterValidator, Field, JsonValue, model_validator

from ome_zarr_models._utils import duplicates
from ome_zarr_models.base import Base
Expand Down Expand Up @@ -203,11 +203,11 @@ class Multiscale(Base):
AfterValidator(_ensure_axis_types),
]
datasets: Datasets = Field(..., min_length=1)
version: Any | None = None
version: Literal["0.4"] | None = None
coordinateTransformations: ValidTransform | None = None
metadata: Any = None
name: Any | None = None
type: Any = None
metadata: JsonValue = None
name: JsonValue | None = None
type: JsonValue = None

@property
def ndim(self) -> int:
Expand Down

0 comments on commit 434a405

Please sign in to comment.