Skip to content

a statically typed model_dump #127

@d-v-b

Description

@d-v-b

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions