From c7f1c53d8a21e528fe26c0e9093eebe0320b3374 Mon Sep 17 00:00:00 2001 From: esdete Date: Tue, 14 May 2024 13:39:04 +0200 Subject: [PATCH] Fix for unstable enum description templating_utils.py set is not ordered and may lead to not reproducible results between different python implementation. The root cause probably lays in different hash function implementation. Windows Python 3.10.11: >>> set((type(None),str)) {, } Ubuntu Python 3.10.11 >>> set((type(None), str)) {, } --- json_schema_for_humans/templating_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json_schema_for_humans/templating_utils.py b/json_schema_for_humans/templating_utils.py index 8030f60..d4ab120 100644 --- a/json_schema_for_humans/templating_utils.py +++ b/json_schema_for_humans/templating_utils.py @@ -54,7 +54,7 @@ def _enum_type(enum_values: List["SchemaNode"]) -> str: for python_type_name in set(type(v.literal) for v in enum_values) ] if enum_type_names: - return f"{const.TYPE_ENUM} (of {' or '.join(enum_type_names)})" + return f"{const.TYPE_ENUM} (of {' or '.join(sorted(enum_type_names))})" return const.TYPE_ENUM