From 7b31cb6e627f9767138fa696381e2f3753739d5f Mon Sep 17 00:00:00 2001 From: Guilherme Branco Date: Mon, 27 May 2024 11:35:23 -0300 Subject: [PATCH] fix: does not include class param to non class type --- pkg/generators/golang/json_generator.go | 12 +++++++----- pkg/generators/golang/types_generator.go | 6 ++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pkg/generators/golang/json_generator.go b/pkg/generators/golang/json_generator.go index 018db16..4fe0651 100644 --- a/pkg/generators/golang/json_generator.go +++ b/pkg/generators/golang/json_generator.go @@ -1306,11 +1306,13 @@ func (g *JSONSupportGenerator) generateReadValue(variable string, typ *concepts. break } switch field { - case "kind": - text := iterator.ReadString() - {{ .Variable }}.link = text == {{ $structName }}LinkKind - case "href": - {{ .Variable }}.href = iterator.ReadString() + {{ if .Type.IsClass }} + case "kind": + text := iterator.ReadString() + {{ .Variable }}.link = text == {{ $structName }}LinkKind + case "href": + {{ .Variable }}.href = iterator.ReadString() + {{ end }} case "items": {{ .Variable }}.items = {{ readTypeFunc .Type }}(iterator) default: diff --git a/pkg/generators/golang/types_generator.go b/pkg/generators/golang/types_generator.go index f239fb1..a839a9f 100644 --- a/pkg/generators/golang/types_generator.go +++ b/pkg/generators/golang/types_generator.go @@ -456,8 +456,10 @@ func (g *TypesGenerator) generateStructTypeSource(typ *concepts.Type) { // {{ $listName }} is a list of values of the '{{ .Type.Name }}' type. type {{ $listName }} struct { - href string - link bool + {{ if .Type.IsClass }} + href string + link bool + {{ end }} items []*{{ $objectName }} }