diff --git a/src/bo4e_generator/parser.py b/src/bo4e_generator/parser.py index b363f4f..2cc2104 100644 --- a/src/bo4e_generator/parser.py +++ b/src/bo4e_generator/parser.py @@ -2,6 +2,7 @@ Contains code to generate pydantic v2 models from json schemas. Since the used tool doesn't support all features we need, we monkey patch some functions. """ +import itertools import re from pathlib import Path from typing import Sequence, Tuple, Type @@ -149,9 +150,8 @@ def bo4e_init_file_content(namespace: dict[str, SchemaMetadata], version: str) - init_file_content = INIT_FILE_COMMENT.strip().format(version=version) init_file_content += "\n\n__all__ = [\n" - for class_name in namespace: + for class_name in sorted(itertools.chain(namespace, ["__version__"])): init_file_content += f' "{class_name}",\n' - init_file_content += ' "__version__",\n' init_file_content += "]\n\n" for schema_metadata in namespace.values():