File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
import numbers
2
+ from pathlib import Path
2
3
from typing import Mapping , Union
3
4
4
5
import jsonschema
@@ -70,12 +71,15 @@ def validate(
70
71
71
72
version = version or variables .SCHEMA_VERSION
72
73
73
- schema = load_schema (f' { version } / { schema_name } ' )
74
+ schema = load_schema (str ( Path ( version ). joinpath ( schema_name )) )
74
75
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
76
80
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 ,
79
83
store = variables .SCHEMA_CACHE ,
80
84
)
81
85
You can’t perform that action at this time.
0 commit comments