spatialdata icon indicating copy to clipboard operation
spatialdata copied to clipboard

classmethod vs. instance method of Model.validate() functions

Open grst opened this issue 4 months ago • 1 comments

Hi,

I noticed the following inconsistencies in the model classes.

For some models, e.g. PointsModel, .validate() is a class method, i.e. I can call it like

SomethingModel.validate(obj)

However for others, e.g. TableModel, it's a standard method, which means I have to do

TableModel().validate(obj)

Is there a specific reason for that? On first glance at the TableModel code, I couln't see the validation code to take advantage of any object states that would requrie it to operate on an instance.

grst avatar Aug 27 '25 12:08 grst

Hi @grst , sorry for the late reply. Have been busy with zarr v3 work. The behaviour you describe is probably due to the raster validation having to call xarray schema validation in the superclass. We have a todo to check whether we can make this consistent.

melonora avatar Sep 08 '25 08:09 melonora