From a9bf13ca04044e8b7320dc76a49c4dd287951686 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Otto?= Date: Mon, 8 Jan 2024 08:45:24 +0100 Subject: [PATCH 1/2] Use equal for enum validator --- jsonschema/_keywords.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/jsonschema/_keywords.py b/jsonschema/_keywords.py index 4c59e90e..92ea52cd 100644 --- a/jsonschema/_keywords.py +++ b/jsonschema/_keywords.py @@ -264,11 +264,7 @@ def dependentSchemas(validator, dependentSchemas, instance, schema): def enum(validator, enums, instance, schema): - if instance == 0 or instance == 1: - unbooled = unbool(instance) - if all(unbooled != unbool(each) for each in enums): - yield ValidationError(f"{instance!r} is not one of {enums!r}") - elif instance not in enums: + if all(not equal(each, instance) for each in enums): yield ValidationError(f"{instance!r} is not one of {enums!r}") From 9a3d4a770813484be066ead99edf2e779b72362a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Jan 2024 07:46:56 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- jsonschema/_keywords.py | 1 - 1 file changed, 1 deletion(-) diff --git a/jsonschema/_keywords.py b/jsonschema/_keywords.py index 92ea52cd..f33a1aa3 100644 --- a/jsonschema/_keywords.py +++ b/jsonschema/_keywords.py @@ -8,7 +8,6 @@ find_additional_properties, find_evaluated_item_indexes_by_schema, find_evaluated_property_keys_by_schema, - unbool, uniq, ) from jsonschema.exceptions import FormatError, ValidationError