Repository: great-expectations/great_expectations

Issue:
Use cleaner solution for non-truncating division in python 2
Prefer `from __future__ import division` to `1.*x/y`


Discussion:
Done inline during improve_partitions push.

Resolving patch:
diff --git a/great_expectations/core/usage_statistics/schemas.py b/great_expectations/core/usage_statistics/schemas.py
--- a/great_expectations/core/usage_statistics/schemas.py
+++ b/great_expectations/core/usage_statistics/schemas.py
@@ -2,7 +2,7 @@
 # These schemas are used to ensure that we *never* take unexpected usage stats message and provide full transparency
 # about usage statistics. Please reach out to the Great Expectations with any questions!
 ###
-
+from typing import List
 
 from great_expectations.core.usage_statistics.anonymizers.types.base import (
     CLISuiteInteractiveFlagCombinations,
@@ -14,7 +14,8 @@
     InstallEnvironment,
 )
 
-SCHEMA: str = "http://json-schema.org/draft-04/schema#"
+SCHEMA: str = "https://json-schema.org/draft/2020-12/schema"
+ALLOWED_VERSIONS: List[str] = ["1.0.0", "1.0.1"]
 
 anonymized_string_schema = {
     "$schema": SCHEMA,
@@ -297,7 +298,7 @@
     },
     "type": "object",
     "properties": {
-        "version": {"enum": ["1.0.0"]},
+        "version": {"enum": ALLOWED_VERSIONS},
         "platform.system": {"type": "string", "maxLength": 256},
         "platform.release": {"type": "string", "maxLength": 256},
         "version_info": {"type": "string", "maxLength": 256},
@@ -960,7 +961,7 @@
     },
     "type": "object",
     "properties": {
-        "version": {"enum": ["1.0.0"]},
+        "version": {"enum": ALLOWED_VERSIONS},
         "ge_version": {"type": "string", "maxLength": 32},
         "data_context_id": {"type": "string", "format": "uuid"},
         "data_context_instance_id": {"type": "string", "format": "uuid"},
diff --git a/great_expectations/core/usage_statistics/usage_statistics.py b/great_expectations/core/usage_statistics/usage_statistics.py
--- a/great_expectations/core/usage_statistics/usage_statistics.py
+++ b/great_expectations/core/usage_statistics/usage_statistics.py
@@ -173,7 +173,7 @@ def _get_serialized_dependencies() -> List[dict]:
         return serialized_dependencies
 
     def build_envelope(self, message: dict) -> dict:
-        message["version"] = "1.0.0"
+        message["version"] = "1.0.1"
         message["ge_version"] = self._ge_version
 
         message["data_context_id"] = self._data_context_id
@@ -198,7 +198,10 @@ def build_envelope(self, message: dict) -> dict:
     @staticmethod
     def validate_message(message: dict, schema: dict) -> bool:
         try:
-            jsonschema.validate(message, schema=schema)
+            jsonschema.validators.Draft202012Validator(
+                schema=schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
             return True
         except jsonschema.ValidationError as e:
             logger.debug(


Test patch:
diff --git a/tests/core/usage_statistics/test_schema_validation.py b/tests/core/usage_statistics/test_schema_validation.py
--- a/tests/core/usage_statistics/test_schema_validation.py
+++ b/tests/core/usage_statistics/test_schema_validation.py
@@ -18,10 +18,16 @@
 
 def test_anonymized_name_validation():
     string = "aa41efe0a1b3eeb9bf303e4561ff8392"
-    jsonschema.validate(string, anonymized_string_schema)
+    jsonschema.validators.Draft202012Validator(
+        schema=anonymized_string_schema,
+        format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+    ).validate(string)
 
     with pytest.raises(jsonschema.ValidationError):
-        jsonschema.validate(string[:5], anonymized_string_schema)
+        jsonschema.validators.Draft202012Validator(
+            schema=anonymized_string_schema,
+            format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+        ).validate(string[:5])
 
 
 def test_anonymized_datasource_validation():
@@ -29,21 +35,30 @@ def test_anonymized_datasource_validation():
         "anonymized_name": "aa41efe0a1b3eeb9bf303e4561ff8392",
         "parent_class": "hello",
     }
-    jsonschema.validate(record, anonymized_datasource_schema)
+    jsonschema.validators.Draft202012Validator(
+        schema=anonymized_datasource_schema,
+        format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+    ).validate(record)
 
     record = {
         "anonymized_name": "aa41efe0a1b3eeb9bf303e4561ff8392",
         "parent_class": "hello",
         "anonymized_class": "aa41efe0a1b3eeb9bf303e4561ff8392",
     }
-    jsonschema.validate(record, anonymized_datasource_schema)
+    jsonschema.validators.Draft202012Validator(
+        schema=anonymized_datasource_schema,
+        format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+    ).validate(record)
     record = {
         "anonymized_name": "aa41efe0a1b3eeb9bf303e4561ff8392",
         "parent_class": "SparkDFDataset",
         "anonymized_class": "aa41efe0a1b3eeb9bf303e4561ff8392",
         "sqlalchemy_dialect": "postgres",
     }
-    jsonschema.validate(record, anonymized_datasource_schema)
+    jsonschema.validators.Draft202012Validator(
+        schema=anonymized_datasource_schema,
+        format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+    ).validate(record)
 
 
 def test_init_payload_validation():
@@ -127,7 +142,10 @@ def test_init_payload_validation():
             }
         ],
     }
-    jsonschema.validate(payload, anonymized_init_payload_schema)
+    jsonschema.validators.Draft202012Validator(
+        schema=anonymized_init_payload_schema,
+        format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+    ).validate(payload)
 
 
 def test_run_val_op_message():
@@ -143,7 +161,10 @@ def test_run_val_op_message():
         "data_context_instance_id": "4f6deb55-8fbd-4131-9f97-b42b0902eae5",
         "ge_version": "0.9.7+203.ge3a97f44.dirty",
     }
-    jsonschema.validate(message, anonymized_usage_statistics_record_schema)
+    jsonschema.validators.Draft202012Validator(
+        schema=anonymized_usage_statistics_record_schema,
+        format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+    ).validate(message)
 
 
 def test_anonymized_domain_builder_schema():
@@ -168,7 +189,10 @@ def test_anonymized_domain_builder_schema():
     ]
 
     for message in messages:
-        jsonschema.validate(message, anonymized_domain_builder_schema)
+        jsonschema.validators.Draft202012Validator(
+            schema=anonymized_domain_builder_schema,
+            format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+        ).validate(message)
 
 
 def test_anonymized_parameter_builder_schema() -> None:
@@ -196,7 +220,10 @@ def test_anonymized_parameter_builder_schema() -> None:
     ]
 
     for message in messages:
-        jsonschema.validate(message, anonymized_parameter_builder_schema)
+        jsonschema.validators.Draft202012Validator(
+            schema=anonymized_parameter_builder_schema,
+            format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+        ).validate(message)
 
 
 def test_anonymized_expectation_configuration_builder_schema() -> None:
@@ -255,7 +282,10 @@ def test_anonymized_rule_schema():
         ],
     }
 
-    jsonschema.validate(message, anonymized_rule_schema)
+    jsonschema.validators.Draft202012Validator(
+        schema=anonymized_rule_schema,
+        format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+    ).validate(message)
 
 
 def test_anonymized_rule_based_profiler_validation():
@@ -302,12 +332,18 @@ def test_anonymized_rule_based_profiler_validation():
     }
 
     # Populated payload (valid)
-    jsonschema.validate(message, anonymized_rule_based_profiler_run_schema)
+    jsonschema.validators.Draft202012Validator(
+        schema=anonymized_rule_based_profiler_run_schema,
+        format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+    ).validate(message)
 
     # Remove mandatory field (invalid)
     with pytest.raises(jsonschema.ValidationError) as e:
         message.pop("variable_count")
-        jsonschema.validate(message, anonymized_rule_based_profiler_run_schema)
+        jsonschema.validators.Draft202012Validator(
+            schema=anonymized_rule_based_profiler_run_schema,
+            format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+        ).validate(message)
 
     expected_error_msg = "'variable_count' is a required property"
     assert any(
@@ -317,4 +353,53 @@ def test_anonymized_rule_based_profiler_validation():
 
     # Empty payload (valid)
     message.clear()
-    jsonschema.validate(message, anonymized_rule_based_profiler_run_schema)
+    jsonschema.validators.Draft202012Validator(
+        schema=anonymized_rule_based_profiler_run_schema,
+        format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+    ).validate(message)
+
+
+def test_uuid_format_validation_success():
+    message = {
+        "event_payload": {
+            "anonymized_operator_name": "50daa62a8739db21009f452f7e36153b",
+        },
+        "event": "data_context.run_validation_operator",
+        "success": True,
+        "version": "1.0.0",
+        "event_time": "2020-03-26T23:02:17.932Z",
+        "data_context_id": "705dd2a2-27f8-470f-9ebe-e7058fd7a534",
+        "data_context_instance_id": "4f6deb55-8fbd-4131-9f97-b42b0902eae5",
+        "ge_version": "0.9.7+203.ge3a97f44.dirty",
+    }
+    try:
+        jsonschema.validators.Draft202012Validator(
+            schema=anonymized_usage_statistics_record_schema,
+            format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+        ).validate(message)
+    except jsonschema.ValidationError as e:
+        assert False, e.message
+
+
+def test_uuid_format_validation_failure():
+    message = {
+        "event_payload": {
+            "anonymized_operator_name": "50daa62a8739db21009f452f7e36153b",
+        },
+        "event": "data_context.run_validation_operator",
+        "success": True,
+        "version": "1.0.0",
+        "event_time": "2020-03-26T23:02:17.932Z",
+        "data_context_id": "705dd2a2-27f8-470f-9ebe-e7058fd7a534",
+        "data_context_instance_id": "4f6deb55-8fbd-4131-9f97-b42b0902eae5 other_invalid_text",
+        "ge_version": "0.9.7+203.ge3a97f44.dirty",
+    }
+    with pytest.raises(jsonschema.ValidationError) as e:
+        jsonschema.validators.Draft202012Validator(
+            schema=anonymized_usage_statistics_record_schema,
+            format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+        ).validate(message)
+    assert (
+        "'4f6deb55-8fbd-4131-9f97-b42b0902eae5 other_invalid_text' is not a 'uuid'"
+        in e.value.message
+    )
diff --git a/tests/core/usage_statistics/test_usage_statistics_handler_methods.py b/tests/core/usage_statistics/test_usage_statistics_handler_methods.py
--- a/tests/core/usage_statistics/test_usage_statistics_handler_methods.py
+++ b/tests/core/usage_statistics/test_usage_statistics_handler_methods.py
@@ -158,7 +158,7 @@ def test_usage_statistics_handler_build_envelope(
     ]
     assert all([key in envelope.keys() for key in required_keys])
 
-    assert envelope["version"] == "1.0.0"
+    assert envelope["version"] == "1.0.1"
     assert envelope["data_context_id"] == "00000000-0000-0000-0000-000000000001"
 
 
diff --git a/tests/core/usage_statistics/test_usage_stats_schema.py b/tests/core/usage_statistics/test_usage_stats_schema.py
--- a/tests/core/usage_statistics/test_usage_stats_schema.py
+++ b/tests/core/usage_statistics/test_usage_stats_schema.py
@@ -98,15 +98,15 @@ def test_init_message():
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
             # record itself
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
             # non-empty payload
-            jsonschema.validate(
-                message["event_payload"],
-                anonymized_init_payload_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_init_payload_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_data_asset_validate_message():
@@ -116,15 +116,15 @@ def test_data_asset_validate_message():
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
             # record itself
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
             # non-empty payload
-            jsonschema.validate(
-                message["event_payload"],
-                anonymized_batch_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_batch_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_data_context_add_datasource_message():
@@ -134,15 +134,15 @@ def test_data_context_add_datasource_message():
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
             # record itself
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
             # non-empty payload
-            jsonschema.validate(
-                message["event_payload"],
-                anonymized_datasource_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_datasource_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_data_context_get_batch_list_message():
@@ -152,14 +152,14 @@ def test_data_context_get_batch_list_message():
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
             # record itself
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
-            jsonschema.validate(
-                message["event_payload"],
-                anonymized_batch_request_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_batch_request_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_checkpoint_run_message():
@@ -169,14 +169,14 @@ def test_checkpoint_run_message():
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
             # record itself
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
-            jsonschema.validate(
-                message["event_payload"],
-                anonymized_checkpoint_run_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_checkpoint_run_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_run_validation_operator_message():
@@ -184,14 +184,14 @@ def test_run_validation_operator_message():
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
             # record itself
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
-            jsonschema.validate(
-                message["event_payload"],
-                anonymized_run_validation_operator_payload_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_run_validation_operator_payload_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_legacy_profiler_build_suite_message():
@@ -201,14 +201,14 @@ def test_legacy_profiler_build_suite_message():
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
             # record itself
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
-            jsonschema.validate(
-                message["event_payload"],
-                anonymized_legacy_profiler_build_suite_payload_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_legacy_profiler_build_suite_payload_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_data_context_save_expectation_suite_message():
@@ -220,14 +220,14 @@ def test_data_context_save_expectation_suite_message():
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
             # record itself
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
-            jsonschema.validate(
-                message["event_payload"],
-                anonymized_get_or_edit_or_save_expectation_suite_payload_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_get_or_edit_or_save_expectation_suite_payload_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_datasource_sqlalchemy_connect_message():
@@ -238,14 +238,14 @@ def test_datasource_sqlalchemy_connect_message():
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
             # record itself
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
-            jsonschema.validate(
-                message["event_payload"],
-                anonymized_datasource_sqlalchemy_connect_payload_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_datasource_sqlalchemy_connect_payload_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_cli_data_asset_validate():
@@ -256,10 +256,10 @@ def test_cli_data_asset_validate():
         for message in valid_usage_statistics_messages[message_type]:
 
             # record itself
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
 
 
 def test_cli_new_ds_choice_message():
@@ -269,10 +269,10 @@ def test_cli_new_ds_choice_message():
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
             # non-empty payload
-            jsonschema.validate(
-                message["event_payload"],
-                anonymized_cli_new_ds_choice_payload_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_cli_new_ds_choice_payload_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_cli_suite_new_message():
@@ -282,14 +282,14 @@ def test_cli_suite_new_message():
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
             # record itself
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
-            jsonschema.validate(
-                message["event_payload"],
-                anonymized_cli_suite_expectation_suite_payload_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_cli_suite_expectation_suite_payload_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_cli_suite_edit_message():
@@ -299,14 +299,14 @@ def test_cli_suite_edit_message():
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
             # record itself
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
-            jsonschema.validate(
-                message["event_payload"],
-                anonymized_cli_suite_expectation_suite_payload_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_cli_suite_expectation_suite_payload_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 @pytest.mark.slow  # 2.42s
@@ -317,14 +317,14 @@ def test_test_yaml_config_messages():
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
             # record itself
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
-            jsonschema.validate(
-                message["event_payload"],
-                anonymized_test_yaml_config_payload_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_test_yaml_config_payload_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_usage_stats_empty_payload_messages():
@@ -337,14 +337,14 @@ def test_usage_stats_empty_payload_messages():
     ]
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
-            jsonschema.validate(
-                message["event_payload"],
-                empty_payload_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
+            jsonschema.validators.Draft202012Validator(
+                schema=empty_payload_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_usage_stats_expectation_suite_messages():
@@ -353,14 +353,14 @@ def test_usage_stats_expectation_suite_messages():
     ]
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
-            jsonschema.validate(
-                message["event_payload"],
-                empty_payload_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
+            jsonschema.validators.Draft202012Validator(
+                schema=empty_payload_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 @pytest.mark.slow  # 5.20s
@@ -392,10 +392,10 @@ def test_usage_stats_cli_payload_messages():
     ]
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
 
 
 def test_rule_based_profiler_run_message():
@@ -404,14 +404,14 @@ def test_rule_based_profiler_run_message():
     ]
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
-            jsonschema.validate(
-                message["event_payload"],
-                anonymized_rule_based_profiler_run_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_rule_based_profiler_run_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_cloud_migrate_event():
@@ -420,14 +420,14 @@ def test_cloud_migrate_event():
     ]
     for message_type in usage_stats_records_messages:
         for message in valid_usage_statistics_messages[message_type]:
-            jsonschema.validate(
-                message,
-                anonymized_usage_statistics_record_schema,
-            )
-            jsonschema.validate(
-                message["event_payload"],
-                cloud_migrate_schema,
-            )
+            jsonschema.validators.Draft202012Validator(
+                schema=anonymized_usage_statistics_record_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message)
+            jsonschema.validators.Draft202012Validator(
+                schema=cloud_migrate_schema,
+                format_checker=jsonschema.validators.Draft202012Validator.FORMAT_CHECKER,
+            ).validate(message["event_payload"])
 
 
 def test_usage_stats_schema_in_codebase_is_up_to_date() -> None: