From fc12ecfecf4d9fefdb4b801b94e2601ead111aad Mon Sep 17 00:00:00 2001 From: Ivan Garcia Sainz-Aja Date: Wed, 6 Nov 2024 12:59:18 +0100 Subject: [PATCH] [openapi-karate] fixes generated `queryParams` object --- .../java/io/zenwave360/sdk/plugins/OpenAPIKarateGenerator.java | 2 +- .../OpenAPIKarateGenerator/partials/Operation.feature.hbs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/openapi-karate/src/main/java/io/zenwave360/sdk/plugins/OpenAPIKarateGenerator.java b/plugins/openapi-karate/src/main/java/io/zenwave360/sdk/plugins/OpenAPIKarateGenerator.java index 93e16915..5c2bf4c1 100644 --- a/plugins/openapi-karate/src/main/java/io/zenwave360/sdk/plugins/OpenAPIKarateGenerator.java +++ b/plugins/openapi-karate/src/main/java/io/zenwave360/sdk/plugins/OpenAPIKarateGenerator.java @@ -127,7 +127,7 @@ public List generate(Map contextModel) { handlebarsEngine.getHandlebars().registerHelper("paramsExample", (params, options) -> { return ((Collection) params).stream() - .map(p -> p.get("name") + ": " + firstNonNull(p.get("example"), jsonSchemaToJsonFaker.generateExample((Map) p.get("schema")))) + .map(p -> p.get("name") + ": " + firstNonNull(p.get("example"), jsonSchemaToJsonFaker.generateExample((String) p.get("name"), (Map) p.get("schema")))) .collect(Collectors.joining(", ")); }); diff --git a/plugins/openapi-karate/src/main/resources/io/zenwave360/sdk/plugins/OpenAPIKarateGenerator/partials/Operation.feature.hbs b/plugins/openapi-karate/src/main/resources/io/zenwave360/sdk/plugins/OpenAPIKarateGenerator/partials/Operation.feature.hbs index 8c30ece5..14b24716 100644 --- a/plugins/openapi-karate/src/main/resources/io/zenwave360/sdk/plugins/OpenAPIKarateGenerator/partials/Operation.feature.hbs +++ b/plugins/openapi-karate/src/main/resources/io/zenwave360/sdk/plugins/OpenAPIKarateGenerator/partials/Operation.feature.hbs @@ -3,7 +3,7 @@ {{~/if}} Given path {{{karatePath operation}}} {{~#if (queryParams operation)}} -And def queryParams = {{{paramsExample (queryParams operation)}}} +And def queryParams = { {{{paramsExample (queryParams operation)}}} } {{~/if}} {{~#if operation.x--request-dto}} And request