Consider changing the default deserialization extra
mode to allow
#1113
bruno-f-cruz
started this conversation in
Ideas
Replies: 1 comment
-
Adding a point here, the current setting also blocks us from using the This kind of seems like it might be a bug in pydantic, not sure they intended for this interaction. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
This is something that we have informally discussed before but I keep bumping into it, so might as well have an issue for reference.
The current deserialization mode of the base class
AindModel
forbids extra fields. This behavior makes it really hard to inherit and modify base classes by composition and deserializing back to the base class.aind-data-schema/src/aind_data_schema/base.py
Line 49 in a965558
This behavior can be super useful when downcasting / upcasting. For example:
AllenNeuralDynamics/aind-metadata-mapper#151
and prevents lossy data ingestion:
#788 (comment)
Describe the solution you'd like
Change the extra mode to
allow
Describe alternatives you've considered
Change the extra mode to
ignore
. It wouldn't allow for lossless up/downcasting but at least wouldn't throw errorsAdditional context
Either of these solutions would remove the automatic validation of properties at runtime. This may be important to get rid of typos.
Beta Was this translation helpful? Give feedback.
All reactions