because BaseModel.model_dump takes parameters that alter its return type, it can't really be statically typed, at least in the current version of the python type system. For zarr in particular it would be useful to have something like model_dump that doesn't take any parameters and returns a dict that is a valid metadata document, with a well-defined type. Such a method would relieve the need to define special serialization rules in model_dump or via field serializer logic (like omitting dimension_names if the value is None).
One complication here is that for zarr v2, there are 2 metadata documents: .zgroup / .zarray, and .zattrs. I'm not sure how much that should matter for this method, though.
because
BaseModel.model_dumptakes parameters that alter its return type, it can't really be statically typed, at least in the current version of the python type system. For zarr in particular it would be useful to have something likemodel_dumpthat doesn't take any parameters and returns a dict that is a valid metadata document, with a well-defined type. Such a method would relieve the need to define special serialization rules inmodel_dumpor via field serializer logic (like omittingdimension_namesif the value isNone).One complication here is that for zarr v2, there are 2 metadata documents: .zgroup / .zarray, and .zattrs. I'm not sure how much that should matter for this method, though.