From 3c8b155bd35d790ca64a1b8504294991144a4788 Mon Sep 17 00:00:00 2001 From: Paul Horton Date: Thu, 17 Apr 2025 16:28:05 +0100 Subject: [PATCH 1/2] fix: Support PathParams not of primitive types for Go in generated tests 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 79caa6213eab..217458ad3fe9 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() From a224c985d4100a539cc9cb4957698347ec6c03af Mon Sep 17 00:00:00 2001 From: Paul Horton Date: Thu, 24 Apr 2025 14:09:18 +0100 Subject: [PATCH 2/2] use tabs consistently --- .../openapi-generator/src/main/resources/go/api_test.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 217458ad3fe9..0514476b4fbc 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,7 @@ func Test_{{packageName}}_{{classname}}Service(t *testing.T) { t.Skip("skip test") // remove to run test {{/-first}} - {{#isPrimitiveType}} + {{#isPrimitiveType}} var {{paramName}} {{{dataType}}} {{/isPrimitiveType}} {{^isPrimitiveType}}