@@ -71,11 +71,15 @@ def validate_required_fields(field_names:list[str], values:list[Any]):
7171 raise ValueError(f"{field_name} is required")
7272 if isinstance(value, str) and not value.strip():
7373 raise ValueError(f"{field_name} cannot be blank")
74- {% - macro gen_properties (attribute_defs ) %}
74+ {% - macro gen_properties (attribute_defs , additional_names =[] ) %}
7575 _convience_properties: ClassVar[list[str]] = [
7676 {% - for attribute_def in attribute_defs %}
7777 "{{ attribute_def.name | to_snake_case }}",
78- {% - endfor %} ]
78+ {% - endfor %}
79+ {% - for name in additional_names %}
80+ "{{ name }}",
81+ {% - endfor %} ]
82+
7983 {% - for attribute_def in attribute_defs %}
8084 {% - set type = attribute_def .typeName | get_type %}
8185 {% - set property_type %}{% if attribute_def .isOptional %} Optional[{% endif %} {{type}}{% if attribute_def .isOptional %} ]{% endif %}{% endset %}
@@ -107,7 +111,19 @@ class {{ entity_def.name }}({{super_classes[0]}} {%- if "Asset" in super_classes
107111 return object.__setattr__(self, name, value)
108112 super().__setattr__( name, value)
109113
110- {{ gen_properties(entity_def.attribute_defs) }}
114+ {{ gen_properties(entity_def.attribute_defs, ["terms"] ) }}
115+
116+ @property
117+ def terms(self) -> list[AtlasGlossaryTerm]:
118+ if self.attributes is None:
119+ self.attributes = self.Attributes()
120+ return [] if self.attributes.meanings is None else self.attributes.meanings
121+
122+ @terms.setter
123+ def terms(self, terms: list[AtlasGlossaryTerm]):
124+ if self.attributes is None:
125+ self.attributes = self.Attributes()
126+ self.attributes.meanings = terms
111127
112128{% - if entity_def .name == "Referenceable" %}
113129
0 commit comments