From 69d4fa673eb59f0e42ed73c47c169d26eff0b38e Mon Sep 17 00:00:00 2001 From: poutysquire10 <45274359+poutysquire10@users.noreply.github.com> Date: Tue, 4 Feb 2020 14:50:57 +0100 Subject: [PATCH] Issue #32: Windows urlopen error For windows local path the base_uri parameter of JsonRef.replace_refs(...) requires three slashes i.e. file:///d:\mydir\subdir... --- openapi2jsonschema/command.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openapi2jsonschema/command.py b/openapi2jsonschema/command.py index 9cd1bfc..a12d078 100644 --- a/openapi2jsonschema/command.py +++ b/openapi2jsonschema/command.py @@ -183,7 +183,11 @@ def default(output, schema, prefix, stand_alone, expanded, kubernetes, strict): specification = updated if stand_alone: - base = "file://%s/%s/" % (os.getcwd(), output) + ### base = "file://%s/%s/" % (os.getcwd(), output) + if os.name == 'nt': + base = "file:///%s/%s/" % (os.getcwd(), output) + else: + base = "file://%s/%s/" % (os.getcwd(), output) specification = JsonRef.replace_refs( specification, base_uri=base)