Skip to content

Commit fdc8ab0

Browse files
committed
Add referencing.jsonschema.EMPTY_REGISTRY.
It's just Registry() but with a SchemaRegistry annotation.
1 parent 783129b commit fdc8ab0

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

docs/changes.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
Changelog
33
=========
44

5+
v0.31.0
6+
-------
7+
8+
* Add ``referencing.jsonschema.EMPTY_REGISTRY`` (which simply has a convenient type annotation, but otherwise is just ``Registry()``).
9+
510
v0.30.2
611
-------
712

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ ignore = [
120120
"D407",
121121
# Plz spaces after section headers
122122
"D412",
123+
# Not sure what heuristic this uses, but it seems easy for it to be wrong.
124+
"SIM300",
123125
# We support 3.8 + 3.9
124126
"UP007",
125127
]

referencing/jsonschema.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
#: A JSON Schema Registry
2222
SchemaRegistry = Registry[Schema]
2323

24+
#: The empty JSON Schema Registry
25+
EMPTY_REGISTRY: SchemaRegistry = Registry()
26+
2427

2528
@frozen
2629
class UnknownDialect(Exception):

referencing/tests/test_jsonschema.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,3 +376,7 @@ def test_multiple_lookup_recursive_ref_with_nonrecursive_ref():
376376
resolver = second.resolver.lookup("bar").resolver
377377
fourth = referencing.jsonschema.lookup_recursive_ref(resolver=resolver)
378378
assert fourth.contents == two.contents
379+
380+
381+
def test_empty_registry():
382+
assert referencing.jsonschema.EMPTY_REGISTRY == Registry()

0 commit comments

Comments
 (0)