Skip to content

Commit

Permalink
make it backward compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
aquamatthias committed Nov 10, 2023
1 parent 6ea0944 commit 8018d3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions resotolib/resotolib/core/model_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def dataclasses_to_resotocore_model(
aggregate_root: Optional[Type[Any]] = None,
walk_subclasses: bool = True,
use_optional_as_required: bool = False,
with_description: bool = False,
with_description: bool = True,
) -> List[Json]:
"""
Analyze all transitive dataclasses and create the model
Expand Down Expand Up @@ -246,10 +246,10 @@ def export_data_class(clazz: type) -> None:
kind = model_name(clazz)
metadata: Json = {}
if (m := getattr(clazz, "metadata", None)) and isinstance(m, dict):
metadata = m
if (s := getattr(clazz, "kind_display", None)) and isinstance(s, str):
metadata = m.copy()
if (s := clazz.__dict__.get("kind_display", None)) and isinstance(s, str):
metadata["name"] = s
if with_description and (s := getattr(clazz, "kind_description", None)) and isinstance(s, str):
if with_description and (s := clazz.__dict__.get("kind_description", None)) and isinstance(s, str):
metadata["description"] = s

model.append(
Expand Down
2 changes: 1 addition & 1 deletion resotolib/resotolib/graph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def export_model(graph: Optional[Graph] = None, **kwargs: Any) -> List[Json]:
for node in graph.nodes:
classes.add(type(node))

model = resource_classes_to_resotocore_model(classes, aggregate_root=BaseResource, **kwargs)
model = resource_classes_to_resotocore_model(classes, aggregate_root=BaseResource, with_description=False, **kwargs)
for resource_model in model:
if resource_model.get("fqn") == "resource":
resource_model.get("properties", []).append(
Expand Down

0 comments on commit 8018d3c

Please sign in to comment.