-
Notifications
You must be signed in to change notification settings - Fork 27
validate_arrays=False (the default) prevents some useful schema patterns #691
Copy link
Copy link
Open
Description
#683 is currently removing the ndim validation for RampModel.pixeldq to allow the model to sometimes have a 2D pixeldq and sometimes a 4D. It would be helpful here to use:
oneOf:
- ndim: 2
- ndim: 4However this will fail on valid 2D and 4D pixeldq because by default validate_arrays=False:
| validate_arrays=False, |
When
validate_arrays is False, the ndim validator is not included in the validation, is therefore unknown to the jsonschema validator, and both subschemas pass causing the oneOf to fail.
If we consider removing validate_arrays it may be helpful to also note that it appears inconsistent. On main the following:
import stdatamodels.jwst.datamodels as dm, numpy as np
m = dm.RampModel()
m.pixeldq = np.zeros((10, 10, 10, 10, 10), dtype='uint32')produces:
ValueError: Array has wrong number of dimensions. Expected 2, got 5with or without validate_arrays enabled.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels