diff --git a/src/schematools/types.py b/src/schematools/types.py index 67928d94..170760ee 100644 --- a/src/schematools/types.py +++ b/src/schematools/types.py @@ -1406,12 +1406,14 @@ def description(self) -> str | None: @property def unit(self) -> str | None: - """Description of the dataset (if set).""" + """Unit of the field (if set).""" unit = self.get("unit") - return unit.get("value", unit) + if isinstance(unit, dict): + return unit.get("value", unit) + return unit @property - def discription_with_unit(self) -> str | None: + def description_with_unit(self) -> str | None: """Description of the dataset (if set), with unit (if set).""" if self.unit: return f"{self.description} [{self.unit}]"