asdf_pydantic.model

Module Contents

Classes

AsdfPydanticModel

ASDF Serialization and Deserialization: Serialize to ASDF yaml tree is done with the asdf_yaml_tree() and deserialize to an AsdfPydanticModel object with model_validate().

API

class asdf_pydantic.model.AsdfPydanticModel

Bases: pydantic.BaseModel

ASDF Serialization and Deserialization: Serialize to ASDF yaml tree is done with the asdf_yaml_tree() and deserialize to an AsdfPydanticModel object with model_validate().

_tag: ClassVar[str | asdf.extension.TagDefinition]

None

model_config

‘ConfigDict(…)’

asdf_yaml_tree() dict

Converts the model to an ASDF-compatible YAML tree (dict).

Note

Any fields that are normal Pydantic BaseModel will be converted to dict. See conversion table.

Conversion Table:

Value type in field

Value type in dict

AsdfPydanticModel

No conversion

BaseModel

Converted to dict using BaseModel.model_dump()

Other types

No conversion

classmethod handle_asdf_tagged_dict_compat(data: Any) dict
classmethod get_tag_definition()
classmethod get_tag_uri()
classmethod model_asdf_schema(by_alias: bool = True, ref_template: str = DEFAULT_ASDF_SCHEMA_REF_TEMPLATE, schema_generator: type[asdf_pydantic.schema.GenerateAsdfSchema] = GenerateAsdfSchema)

Get the ASDF schema definition for this model.

classmethod schema_asdf(*, metaschema: str = GenerateAsdfSchema.schema_dialect, **kwargs) str

Get the ASDF schema definition for this model.

Parameters

metaschema, optional A metaschema URI