Skip to content

Commit 57ec14f

Browse files
committed
fix: correct instantiation of returntype in testcase
1 parent 7c4ba79 commit 57ec14f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

templates/go/api_test.mustache

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,18 @@ func Test_{{packageName}}_{{classname}}Service(t *testing.T) {
4141
{{/returnFormat}}
4242
{{^returnFormat}}
4343
{{#returnType}}
44-
{{#returnTypeIsPrimitive}}
44+
{{#returnProperty.isPrimitiveType}}
45+
{{! according to the model, freeform objects might be primitive...}}
46+
{{#returnProperty.isFreeFormObject}}
47+
data := {{{.}}}{}
48+
{{/returnProperty.isFreeFormObject}}
49+
{{^returnProperty.isFreeFormObject}}
4550
var data {{{.}}}
46-
{{/returnTypeIsPrimitive}}
47-
{{^returnTypeIsPrimitive}}
51+
{{/returnProperty.isFreeFormObject}}
52+
{{/returnProperty.isPrimitiveType}}
53+
{{^returnProperty.isPrimitiveType}}
4854
data := {{{.}}}{}
49-
{{/returnTypeIsPrimitive}}
55+
{{/returnProperty.isPrimitiveType}}
5056
w.Header().Add("Content-Type", "application/json")
5157
json.NewEncoder(w).Encode(data)
5258
{{/returnType}}

0 commit comments

Comments
 (0)