File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 11import numbers
2+ from pathlib import Path
23from typing import Mapping , Union
34
45import jsonschema
@@ -70,12 +71,15 @@ def validate(
7071
7172 version = version or variables .SCHEMA_VERSION
7273
73- schema = load_schema (f' { version } / { schema_name } ' )
74+ schema = load_schema (str ( Path ( version ). joinpath ( schema_name )) )
7475
75- # note: trailing slash needed for RefResolver to resolve correctly
76+ # note: trailing slash needed for RefResolver to resolve correctly and by
77+ # design, pathlib strips trailing slashes. See ref below:
78+ # * https://bugs.python.org/issue21039
79+ # * https://github.com/python/cpython/issues/65238
7680 resolver = jsonschema .RefResolver (
77- base_uri = f"file:// { variables .schemas } / { version } /" ,
78- referrer = f" { schema_name } " ,
81+ base_uri = f"{ Path ( variables .schemas ). joinpath ( version ). as_uri () } /" ,
82+ referrer = schema_name ,
7983 store = variables .SCHEMA_CACHE ,
8084 )
8185
You can’t perform that action at this time.
0 commit comments