diff --git a/openapi2jsonschema/command.py b/openapi2jsonschema/command.py index 9cd1bfc..fa38b7c 100644 --- a/openapi2jsonschema/command.py +++ b/openapi2jsonschema/command.py @@ -58,10 +58,13 @@ def default(output, schema, prefix, stand_alone, expanded, kubernetes, strict): response = urllib.urlopen(schema) else: if os.path.isfile(schema): - schema = "file://" + os.path.realpath(schema) + if sys.version_info >= (3, 4): + import pathlib + schema = pathlib.Path(os.path.realpath(schema)).as_uri() + else: + schema = schema = 'file://' + os.path.realpath(schema) # does not support windows req = urllib.request.Request(schema) response = urllib.request.urlopen(req) - info("Parsing schema") # Note that JSON is valid YAML, so we can use the YAML parser whether # the schema is stored in JSON or YAML