From 17135dfc047f49a4e627f772d9897b4fa67baa59 Mon Sep 17 00:00:00 2001 From: Alf-Ivar Holm Date: Mon, 31 Mar 2025 23:59:39 +0200 Subject: [PATCH] Change null to empty string to fix parsing error (of OpenAPI 3.1 JSON file) Got the error "OpenAPI Parser: Cannot read the array length because "" is null" during import of https://api.elhub.no/energy-data/v0/openapi.json and the stack trace hinted at something wrong coming from buildHttpRequestParameters(). --- src/main/java/swurg/workers/Worker.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/swurg/workers/Worker.java b/src/main/java/swurg/workers/Worker.java index f5edcd1..6789671 100644 --- a/src/main/java/swurg/workers/Worker.java +++ b/src/main/java/swurg/workers/Worker.java @@ -166,7 +166,7 @@ private List buildHttpRequestParameters(List parameter Schema schema = parameter.getSchema(); String value = Optional.ofNullable(schema) .map(Schema::getType) - .orElse(null); + .orElse(""); if ("header".equals(in)) httpParameters.add(HttpParameter.cookieParameter(name, value)); @@ -195,4 +195,4 @@ else if ("query".equals(in)) return httpParameters; } -} \ No newline at end of file +}