Skip to content

Commit 950e065

Browse files
committed
Boolean schemas hacked in.
1 parent e89bcee commit 950e065

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

jsonschema/validators.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ def __init__(
7676
self._types.update(types)
7777

7878
if resolver is None:
79-
resolver = RefResolver.from_schema(schema)
79+
if schema == True:
80+
resolver = RefResolver.from_schema({})
81+
elif schema == False:
82+
resolver = RefResolver.from_schema({"not": {}})
83+
else:
84+
resolver = RefResolver.from_schema(schema)
8085

8186
self.resolver = resolver
8287
self.format_checker = format_checker
@@ -91,6 +96,11 @@ def iter_errors(self, instance, _schema=None):
9196
if _schema is None:
9297
_schema = self.schema
9398

99+
if _schema == True:
100+
_schema = {}
101+
elif _schema == False:
102+
_schema = {"not": {}}
103+
94104
scope = _schema.get(u"id")
95105
if scope:
96106
self.resolver.push_scope(scope)

0 commit comments

Comments
 (0)