From bdb063f170521d67d05dcea622741c4a8d8d2957 Mon Sep 17 00:00:00 2001 From: Paul Horton Date: Fri, 25 Apr 2025 10:09:11 +0100 Subject: [PATCH] fix: Support PathParams not of primitive types for Go in generated tests (#21107) * fix: Support PathParams not of primitive types for Go in generated tests Signed-off-by: Paul Horton * use tabs consistently --------- Signed-off-by: Paul Horton --- .../src/main/resources/go/api_test.mustache | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/openapi-generator/src/main/resources/go/api_test.mustache b/modules/openapi-generator/src/main/resources/go/api_test.mustache index 79caa6213ea..0514476b4fb 100644 --- a/modules/openapi-generator/src/main/resources/go/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/go/api_test.mustache @@ -36,7 +36,12 @@ func Test_{{packageName}}_{{classname}}Service(t *testing.T) { t.Skip("skip test") // remove to run test {{/-first}} + {{#isPrimitiveType}} var {{paramName}} {{{dataType}}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + var {{paramName}} {{goImportAlias}}.{{{dataType}}} + {{/isPrimitiveType}} {{/pathParams}} {{#returnType}}resp, {{/returnType}}httpRes, err := apiClient.{{classname}}.{{operationId}}(context.Background(){{#pathParams}}, {{paramName}}{{/pathParams}}).Execute()