diff --git a/templates/sdk/config.tmpl b/templates/sdk/config.tmpl index 79d7627e..e136743c 100644 --- a/templates/sdk/config.tmpl +++ b/templates/sdk/config.tmpl @@ -103,10 +103,10 @@ {{- if ne $version ""}} {{- if eq $index 1}} if vn.Gte(version{{createGoSuffixFromVersion $version}}) { - return SpecifyConfig, &configXmlContainer{{createGoSuffixFromVersion $version}}{}, nil + return SpecifyConfig{{createGoSuffixFromVersion $version}}, &configXmlContainer{{createGoSuffixFromVersion $version}}{}, nil {{- else}} } else if vn.Gte(version{{createGoSuffixFromVersion $version}}) { - return SpecifyConfig, &configXmlContainer{{createGoSuffixFromVersion $version}}{}, nil + return SpecifyConfig{{createGoSuffixFromVersion $version}}, &configXmlContainer{{createGoSuffixFromVersion $version}}{}, nil {{- end}} {{- end}} {{- end}} @@ -118,20 +118,22 @@ {{- end}} } - func SpecifyConfig(o Config) (any, error) { - config := configXml{} + {{- range $version := .SupportedVersions }} + func SpecifyConfig{{createGoSuffixFromVersion $version}}(o Config) (any, error) { + config := configXml{{createGoSuffixFromVersion $version}}{} - {{- range $_, $param := .Spec.Params}} - {{specifyEntryAssignment "config" $param}} - {{- end}} - {{- range $_, $param := .Spec.OneOf}} - {{specifyEntryAssignment "config" $param}} - {{- end}} + {{- range $_, $param := $.Spec.Params}} + {{specifyEntryAssignment "config" $param $version}} + {{- end}} + {{- range $_, $param := $.Spec.OneOf}} + {{specifyEntryAssignment "config" $param $version}} + {{- end}} - config.Misc = o.Misc["Config"] + config.Misc = o.Misc["Config"] - return config, nil - } + return config, nil + } + {{- end}} {{- range $version := .SupportedVersions }} func (c *configXmlContainer{{createGoSuffixFromVersion $version}}) Normalize() ([]Config, error) { @@ -141,10 +143,10 @@ Misc: make(map[string][]generic.Xml), } {{- range $_, $param := $.Spec.Params}} - {{normalizeAssignment "config" $param}} + {{normalizeAssignment "config" $param $version}} {{- end}} {{- range $_, $param := $.Spec.OneOf}} - {{normalizeAssignment "config" $param}} + {{normalizeAssignment "config" $param $version}} {{- end}} config.Misc["Config"] = o.Misc diff --git a/templates/sdk/entry.tmpl b/templates/sdk/entry.tmpl index 07a28030..6ad94404 100644 --- a/templates/sdk/entry.tmpl +++ b/templates/sdk/entry.tmpl @@ -142,10 +142,10 @@ {{- if ne $version ""}} {{- if eq $index 1}} if vn.Gte(version{{createGoSuffixFromVersion $version}}) { - return SpecifyEntry, &entryXmlContainer{{createGoSuffixFromVersion $version}}{}, nil + return SpecifyEntry{{createGoSuffixFromVersion $version}}, &entryXmlContainer{{createGoSuffixFromVersion $version}}{}, nil {{- else}} } else if vn.Gte(version{{createGoSuffixFromVersion $version}}) { - return SpecifyEntry, &entryXmlContainer{{createGoSuffixFromVersion $version}}{}, nil + return SpecifyEntry{{createGoSuffixFromVersion $version}}, &entryXmlContainer{{createGoSuffixFromVersion $version}}{}, nil {{- end}} {{- end}} {{- end}} @@ -157,21 +157,23 @@ {{- end}} } - func SpecifyEntry(o Entry) (any, error) { - entry := entryXml{} + {{- range $version := .SupportedVersions }} + func SpecifyEntry{{createGoSuffixFromVersion $version}}(o Entry) (any, error) { + entry := entryXml{{createGoSuffixFromVersion $version}}{} - entry.Name = o.Name - {{- range $_, $param := .Spec.Params}} - {{specifyEntryAssignment "entry" $param}} - {{- end}} - {{- range $_, $param := .Spec.OneOf}} - {{specifyEntryAssignment "entry" $param}} - {{- end}} + entry.Name = o.Name + {{- range $_, $param := $.Spec.Params}} + {{specifyEntryAssignment "entry" $param $version}} + {{- end}} + {{- range $_, $param := $.Spec.OneOf}} + {{specifyEntryAssignment "entry" $param $version}} + {{- end}} - entry.Misc = o.Misc["Entry"] + entry.Misc = o.Misc["Entry"] - return entry, nil - } + return entry, nil + } + {{- end}} {{- range $version := .SupportedVersions }} func (c *entryXmlContainer{{createGoSuffixFromVersion $version}}) Normalize() ([]Entry, error) { @@ -182,10 +184,10 @@ } entry.Name = o.Name {{- range $_, $param := $.Spec.Params}} - {{normalizeAssignment "entry" $param}} + {{normalizeAssignment "entry" $param $version}} {{- end}} {{- range $_, $param := $.Spec.OneOf}} - {{normalizeAssignment "entry" $param}} + {{normalizeAssignment "entry" $param $version}} {{- end}} entry.Misc["Entry"] = o.Misc