AllenNeuralDynamics / aind-behavior-curriculum

Starter repository for behavior base primitives.
https://aind-behavior-curriculum.readthedocs.io
MIT License
1 stars 0 forks source link

Consider adding `version` field to `Task` class #39

Closed bruno-f-cruz closed 2 weeks ago

bruno-f-cruz commented 2 weeks ago

Is your feature request related to a problem? Please describe. After playing a bit with the current specification, I believe we need a field in Task that version of the task. This version property should follow semantic versioning. This is especially important if considering a case where users might want to validate different versions of the task to a remote trainer on deserialization of the Task object.

Describe the solution you'd like

add the following property to Task:

version: str = Field(..., description="Semantic versioned task version")

There are a few ways to ensure validation, the easiest would likely be:

class MyTask(Task):
   (...)
   version: Literal["0.0.1"] = "0.0.1"

As the field is constant, any json object created with a previous version would end up raising a validation error on deserialization.

Describe alternatives you've considered We should also decide if this is supposed to be an optional or required field

bruno-f-cruz commented 2 weeks ago

I am tempted to leave it as a nullable string (with null as a default) and let users handle whether they want to version the schema on their end or not.