File tree 2 files changed +10
-8
lines changed
2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,13 @@ The format is (loosely) based on [Keep a Changelog](http://keepachangelog.com/)
10
10
11
11
### Added
12
12
13
- - Docstrings https://github.com/stac-utils/stac-validator/pull/224
13
+ - Docstrings ( [ # 224 ] ( https://github.com/stac-utils/stac-validator/pull/224 ) )
14
14
15
15
### Changed
16
16
17
17
- Development dependencies removed from runtime dependency list
18
18
([ #228 ] ( https://github.com/stac-utils/stac-check/pull/109 ) )
19
+ - Remove jsonschema RefResolver ([ #228 ] ( https://github.com/stac-utils/stac-check/pull/109 ) )
19
20
20
21
## [ v3.3.1] - 2022-12-16
21
22
Original file line number Diff line number Diff line change 6
6
7
7
import click # type: ignore
8
8
import jsonschema # type: ignore
9
- from jsonschema import RefResolver
9
+ from jsonschema . validators import validator_for
10
10
from requests import exceptions # type: ignore
11
11
12
12
from .utilities import (
@@ -216,12 +216,13 @@ def custom_validator(self) -> None:
216
216
jsonschema .validate (self .stac_content , schema )
217
217
# in case the path to a json schema is local
218
218
elif os .path .exists (self .schema ):
219
- schema = fetch_and_parse_schema (self .schema )
220
- custom_abspath = os .path .abspath (self .schema )
221
- custom_dir = os .path .dirname (custom_abspath ).replace ("\\ " , "/" )
222
- custom_uri = f"file:///{ custom_dir } /"
223
- resolver = RefResolver (custom_uri , self .schema )
224
- jsonschema .validate (self .stac_content , schema , resolver = resolver )
219
+ schema_dict = fetch_and_parse_schema (self .schema )
220
+ # determine the appropriate validator class for the schema
221
+ ValidatorClass = validator_for (schema_dict )
222
+ validator = ValidatorClass (schema_dict )
223
+ # validate the content
224
+ validator .validate (self .stac_content )
225
+
225
226
# deal with a relative path in the schema
226
227
else :
227
228
file_directory = os .path .dirname (os .path .abspath (str (self .stac_file )))
You can’t perform that action at this time.
0 commit comments