Consider using ClassVar
for schema versioning
#738
bruno-f-cruz
started this conversation in
Ideas
Replies: 1 comment
-
More investigation needs to be done to verify that this doesn't cause any issues. Warnings are usually raised when using references to Literal types. |
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.
There is currently no easy way to get a version of a schema without instantiating a model. This is a bit annoying as models are difficult to fully build to get validation. I suggest that we change the pattern to keep track of schema versions, eg:
https://github.com/AllenNeuralDynamics/aind-data-schema/blob/2c66f2e8a2f89a6b21caa86eb7377ab5aef88280/src/aind_data_schema/base.py#L25C1-L28C1
and instead, make the version of the schema also a class variable. This allows the value to be queried before the instance is created and will not change any of the serialization behavior.
Describe the solution you'd like
Here's a quick example:
Beta Was this translation helpful? Give feedback.
All reactions