From ec3c02ed388b74f4d4bd6fb5bbe4bd22c4de2c5c Mon Sep 17 00:00:00 2001 From: Sebastian Czech Date: Tue, 2 Apr 2024 15:11:34 +0200 Subject: [PATCH] Fix problem with nested specs and versions --- templates/sdk/config.tmpl | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/templates/sdk/config.tmpl b/templates/sdk/config.tmpl index ae0e67e5..e959a9a2 100644 --- a/templates/sdk/config.tmpl +++ b/templates/sdk/config.tmpl @@ -40,12 +40,20 @@ type configXml{{createGoSuffixFromVersion $version}} struct { {{- range $_, $param := $.Spec.Params}} {{- if paramSupportedInVersion $param $version}} - {{$param.Name.CamelCase}} {{xmlParamType "" $param}} {{xmlTag $param}} + {{- if $param.Spec}} + {{$param.Name.CamelCase}} {{xmlParamType "" $param}}{{createGoSuffixFromVersion $version}} {{xmlTag $param}} + {{- else}} + {{$param.Name.CamelCase}} {{xmlParamType "" $param}} {{xmlTag $param}} + {{- end}} {{- end}} {{- end}} {{- range $_, $param := $.Spec.OneOf}} {{- if paramSupportedInVersion $param $version}} - {{$param.Name.CamelCase}} {{xmlParamType "" $param}} {{xmlTag $param}} + {{- if $param.Spec}} + {{$param.Name.CamelCase}} {{xmlParamType "" $param}}{{createGoSuffixFromVersion $version}} {{xmlTag $param}} + {{- else}} + {{$param.Name.CamelCase}} {{xmlParamType "" $param}} {{xmlTag $param}} + {{- end}} {{- end}} {{- end}} @@ -58,12 +66,20 @@ type spec{{$name}}Xml{{createGoSuffixFromVersion $version}} struct { {{- range $_, $param := $spec.Params}} {{- if paramSupportedInVersion $param $version}} - {{$param.Name.CamelCase}} {{xmlParamType $name $param}} {{xmlTag $param}} + {{- if $param.Spec}} + {{$param.Name.CamelCase}} {{xmlParamType $name $param}}{{createGoSuffixFromVersion $version}} {{xmlTag $param}} + {{- else}} + {{$param.Name.CamelCase}} {{xmlParamType $name $param}} {{xmlTag $param}} + {{- end}} {{- end}} {{- end}} {{- range $_, $param := $spec.OneOf}} {{- if paramSupportedInVersion $param $version}} - {{$param.Name.CamelCase}} {{xmlParamType $name $param}} {{xmlTag $param}} + {{- if $param.Spec}} + {{$param.Name.CamelCase}} {{xmlParamType $name $param}}{{createGoSuffixFromVersion $version}} {{xmlTag $param}} + {{- else}} + {{$param.Name.CamelCase}} {{xmlParamType $name $param}} {{xmlTag $param}} + {{- end}} {{- end}} {{- end}}