Skip to content

Commit

Permalink
Rename function XmlPathSuffixes()
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianczech committed Apr 2, 2024
1 parent 3083d8d commit 8e4ecb0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/generate/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (c *Creator) parseTemplate(templateName string) (*template.Template, error)
"nestedSpecs": translate.NestedSpecs,
"createGoSuffixFromVersion": translate.CreateGoSuffixFromVersion,
"paramSupportedInVersion": translate.ParamSupportedInVersion,
"xmlPathSuffix": translate.XmlPathSuffix,
"xmlPathSuffixes": translate.XmlPathSuffixes,
}
return template.New(templateName).Funcs(funcMap).ParseFiles(templatePath)
}
4 changes: 2 additions & 2 deletions pkg/translate/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ func argumentTypeForSpecMatchesFunction(parent []string, param *properties.SpecP
}
}

// XmlPathSuffix return XML path suffixes created from profiles.
func XmlPathSuffix(param *properties.SpecParam) []string {
// XmlPathSuffixes return XML path suffixes created from profiles.
func XmlPathSuffixes(param *properties.SpecParam) []string {
xmlPathSuffixes := []string{}
if param.Profiles != nil {
for _, profile := range param.Profiles {
Expand Down
4 changes: 2 additions & 2 deletions pkg/translate/funcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ return true
assert.Equal(t, expectedNestedSpec, renderedNestedSpecMatches)
}

func TestXmlPathSuffix(t *testing.T) {
func TestXmlPathSuffixes(t *testing.T) {
// given
spec := properties.Spec{
Params: map[string]*properties.SpecParam{
Expand All @@ -263,7 +263,7 @@ func TestXmlPathSuffix(t *testing.T) {
expectedXpathSuffixes := []string{"test/a"}

// when
actualXpathSuffixes := XmlPathSuffix(spec.Params["a"])
actualXpathSuffixes := XmlPathSuffixes(spec.Params["a"])

// then
assert.Equal(t, expectedXpathSuffixes, actualXpathSuffixes)
Expand Down
2 changes: 1 addition & 1 deletion templates/sdk/service.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ package {{packageName .GoSdkPath}}
{{- range $_, $param := $.Spec.Params}}
{{- if paramSupportedInVersion $param $version}}
{{- range $_, $profile := $param.Profiles}}
{{- range $_, $xpath := xmlPathSuffix $param}}
{{- range $_, $xpath := xmlPathSuffixes $param}}
"{{$xpath}}",
{{- end}}
{{- end}}
Expand Down

0 comments on commit 8e4ecb0

Please sign in to comment.