From 5fc057f59143eccf69526637dc631fa8a2f42666 Mon Sep 17 00:00:00 2001 From: poutysquire10 <45274359+poutysquire10@users.noreply.github.com> Date: Tue, 4 Feb 2020 14:56:42 +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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/openapi2jsonschema/command.py b/openapi2jsonschema/command.py index 9cd1bfc..4167363 100644 --- a/openapi2jsonschema/command.py +++ b/openapi2jsonschema/command.py @@ -183,7 +183,12 @@ 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)