Skip to content

Commit 96aabb2

Browse files
authored
Merge pull request #51 from jpthiery/fixWindowsPathLoad
🐛 Fixing URI forge for Windows
2 parents b454bcf + e130187 commit 96aabb2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

openapi_spec_validator/__main__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import logging
22
import argparse
33
import os
4+
import pathlib
45
import sys
56

7+
68
from openapi_spec_validator import validate_spec_url, validate_v2_spec_url
79
from openapi_spec_validator.exceptions import ValidationError
810

@@ -33,7 +35,7 @@ def main(args=None):
3335
validate_url = validate_spec_url
3436
# validate
3537
try:
36-
validate_url('file://'+filename)
38+
validate_url(pathlib.Path(filename).as_uri())
3739
except ValidationError as e:
3840
print(e)
3941
sys.exit(1)

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def run_tests(self):
7171
"jsonschema",
7272
"PyYAML>=4.2b1",
7373
"six",
74+
'pathlib;python_version=="2.7"',
7475
],
7576
tests_require=[
7677
"mock",

0 commit comments

Comments
 (0)