You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a place to discuss versioning the ASDF tags by asdf-pydantic, and a continuation of asdf-format/asdf#1507 (comment).
As a recap of my suggestion:
AsdfPydanticModel should be able to generate its version number (by default) from the version of the library defining the model/extension.
Warnings should be issued if the current version number of the extension doesn't match the version number of the object in question, but pydantic still validates the data. (Technically the tags will change and it won't round-trip correctly)
This make it intuitive for users to figure out which version of the extension library is needed to read the file, and manual forward porting can take place.
The converter can accommodate this by defining the tag in it registers using <tag>-* instead of using the exact version.
The AsdfPydanticModel can introspect this version automatically using something like:
I think an override should be available to override the version number as the user needs.
I would further argue that extension writers should only need to provide a base_uri to the models they construct, rather than the full tag_uri. The specific name attached to the end of the tag can be intuited from the name of the class defined (such as convert the class.__name__ from CamelCase to snake_case), and the version number can be determined as above. Again it might be reasonable to provide an override for the name portion too.
By doing this extension authors can define a class:
This is a place to discuss versioning the ASDF tags by
asdf-pydantic
, and a continuation of asdf-format/asdf#1507 (comment).As a recap of my suggestion:
AsdfPydanticModel
should be able to generate its version number (by default) from the version of the library defining the model/extension.pydantic
still validates the data. (Technically the tags will change and it won't round-trip correctly)The converter can accommodate this by defining the
tag
in it registers using<tag>-*
instead of using the exact version.The
AsdfPydanticModel
can introspect this version automatically using something like:I think an override should be available to override the version number as the user needs.
I would further argue that extension writers should only need to provide a
base_uri
to the models they construct, rather than the fulltag_uri
. The specificname
attached to the end of thetag
can be intuited from the name of theclass
defined (such as convert theclass.__name__
from CamelCase to snake_case), and the version number can be determined as above. Again it might be reasonable to provide an override for thename
portion too.By doing this extension authors can define a class:
Then inherit all their subsequent extension models from this. This way one only needs to define the
base_uri
once rather than coping and changing it.The text was updated successfully, but these errors were encountered: