File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
openapi_spec_validator/schemas Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 11"""OpenAIP spec validator schemas utils module."""
2+ import sys
23from os import path
34from typing import Any
45from typing import Hashable
56from typing import Mapping
67from typing import Tuple
78
8- import importlib_resources
9+ if sys .version_info >= (3 , 9 ):
10+ from importlib .resources import as_file , files
11+ else :
12+ from importlib_resources import as_file , files
913from jsonschema_spec .readers import FilePathReader
1014
1115
1216def get_schema (version : str ) -> Tuple [Mapping [Hashable , Any ], str ]:
1317 schema_path = f"resources/schemas/v{ version } /schema.json"
14- ref = importlib_resources . files ("openapi_spec_validator" ) / schema_path
15- with importlib_resources . as_file (ref ) as resource_path :
18+ ref = files ("openapi_spec_validator" ) / schema_path
19+ with as_file (ref ) as resource_path :
1620 schema_path_full = path .join (path .dirname (__file__ ), resource_path )
1721 return FilePathReader (schema_path_full ).read ()
1822
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ openapi-schema-validator = "^0.3.2"
4949python = " ^3.7.0"
5050PyYAML = " >=5.1"
5151requests = {version = " *" , optional = true }
52- importlib-resources = " ^5.8.0"
52+ importlib-resources = { version = " ^5.8.0" , python = " <3.9 " }
5353jsonschema-spec = " ^0.1.1"
5454lazy-object-proxy = " ^1.7.1"
5555
You can’t perform that action at this time.
0 commit comments