diff --git a/.gitignore b/.gitignore index 8d3d30d..9c376d5 100644 --- a/.gitignore +++ b/.gitignore @@ -133,6 +133,6 @@ dmypy.json # vscode settings .vscode/ -src/_bo4e_python_generator_version.py +src/_bo4e_generator_version.py unittests/output diff --git a/src/bo4e_generator/schema.py b/src/bo4e_generator/schema.py index 1858b49..83161a7 100644 --- a/src/bo4e_generator/schema.py +++ b/src/bo4e_generator/schema.py @@ -75,4 +75,7 @@ def get_version(namespace: dict[str, SchemaMetadata]) -> str: Get the version of the bo4e schemas. """ # The chosen class is arbitrary. All bo's and com's should contain the same version information. - return namespace["Angebot"].schema_parsed["properties"]["_version"]["default"] + try: + return namespace["Angebot"].schema_parsed["properties"]["_version"]["default"] + except KeyError: + return "unknown"