From d2935aa99d7425122f24ef9c1c702d9eb93e0798 Mon Sep 17 00:00:00 2001 From: Halvdan Hoem Grelland Date: Fri, 20 Dec 2024 13:21:35 +0100 Subject: [PATCH] Improve condition for checking if CRD file is a URL Was stumped by this when attempting to include a local CRD file named `httproutes.gateway.networking.k8s.io.json` - which resulted in the following error: ``` ValueError: unknown url type: 'httproutes.gateway.networking.k8s.io.json' ``` Assuming that all`startsWith("http")` was intended to do is discerning local from remote resource references. --- scripts/openapi2jsonschema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/openapi2jsonschema.py b/scripts/openapi2jsonschema.py index 6cda017..64d16ff 100755 --- a/scripts/openapi2jsonschema.py +++ b/scripts/openapi2jsonschema.py @@ -127,7 +127,7 @@ def construct_value(load, node): exit(1) for crdFile in sys.argv[1:]: - if crdFile.startswith("http"): + if crdFile.startswith("http:") or crdFile.startsWith("https:"): f = urllib.request.urlopen(crdFile) else: f = open(crdFile)