policyweaver.models.common

policyweaver.models.common

class policyweaver.models.common.CommonBaseModel

Bases: BaseModel

Base model for all common models in the Policy Weaver application. This model provides common functionality such as alias handling and JSON serialization. Attributes:

model_config (ConfigDict): Configuration for the model.

_abc_impl = <_abc._abc_data object>
_get_alias(item_name)

Get the alias for a given item name. Args:

item_name (str): The name of the item to get the alias for.

Returns:

str: The alias for the item if it exists, otherwise None.

property hash_sha256

Computes the SHA-256 hash of the model’s JSON representation. This is useful for generating a unique identifier for the model based on its content. Returns:

str: The SHA-256 hash of the model’s JSON representation.

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'exclude_none': True, 'exclude_unset': True, 'populate_by_name': True, 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_dump(**kwargs) dict[str, Any]

Dumps the model to a dictionary, using aliases for field names. Args:

**kwargs: Additional keyword arguments to pass to the model dump.

Returns:

dict[str, Any]: The model data as a dictionary with aliases.

model_dump_json(**kwargs) dict[str, Any]

Dumps the model to a JSON string, using aliases for field names. Args:

**kwargs: Additional keyword arguments to pass to the model dump.

Returns:

dict[str, Any]: The model data as a JSON string with aliases.