Skip to content

Commit

Permalink
Fix problem with nested specs and versions
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianczech committed Apr 3, 2024
1 parent b272b01 commit ec3c02e
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions templates/sdk/config.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}

Expand All @@ -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}}

Expand Down

0 comments on commit ec3c02e

Please sign in to comment.