omfg working serialization (with forthcoming updates to numpydantic)

This commit is contained in:
sneakers-the-rat 2024-10-03 01:17:08 -07:00
parent 4672f54630
commit af53ee1ea9
Signed by untrusted user who does not match committer: jonny
GPG key ID: 6DCB96EF1E4D232D
2 changed files with 10 additions and 4 deletions

View file

@ -73,8 +73,14 @@ def test_nwbfile_dump(read_nwbfile):
electrodes = read_nwbfile.general.extracellular_ephys.electrodes.model_dump_json(
round_trip=True
)
data = read_nwbfile.general.model_dump_json(round_trip=True)
file = read_nwbfile.model_dump_json(
round_trip=True, exclude_none=True, exclude_unset=True, exclude_defaults=True
)
# data = read_nwbfile.model_dump_json(round_trip=True, serialize_as_any=True)
# pdb.set_trace()
pdb.set_trace()
def test_timeseries(read_nwbfile, read_pynwb):

View file

@ -17,10 +17,10 @@ from typing import (
Optional,
Tuple,
Type,
TypeVar,
Union,
overload,
)
from typing_extensions import TypeVar
import numpy as np
from numpydantic import NDArray, Shape
@ -154,7 +154,7 @@ class LinkMLMeta(RootModel):
NUMPYDANTIC_VERSION = "1.2.1"
T = TypeVar("T", bound=NDArray)
T = TypeVar("T", default=NDArray)
class VectorDataMixin(ConfiguredBaseModel, Generic[T]):
@ -364,7 +364,7 @@ class TimeSeriesReferenceVectorData(TimeSeriesReferenceVectorDataMixin, VectorDa
description="""Number of data samples available in this time series, during this epoch""",
json_schema_extra={"linkml_meta": {"array": {"exact_number_dimensions": 1}}},
)
timeseries: NDArray[Shape["*"], TimeSeries] = Field(
timeseries: List[TimeSeries] = Field(
...,
description="""The TimeSeries that this index applies to""",
json_schema_extra={"linkml_meta": {"array": {"exact_number_dimensions": 1}}},