Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
corrected code to use new get template function
Browse files Browse the repository at this point in the history
Signed-off-by: Holly Hunt <holly.hunt1101@hotmail.com>
  • Loading branch information
Wyvinar committed Apr 9, 2024
1 parent 85eb140 commit d8e5c1b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions openapi2beans/pkg/generator/package2java.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,19 @@ import (

func convertJavaPackageToJavaFiles(javaPackage *JavaPackage, fs files.FileSystem, storeFilePath string) {
log.Print("convertJavaPackageToJavaFiles: Creating classes")
classTemplate, err := embedded.GetJavaClassTemplate()
classTemplate, err := embedded.GetJavaTemplate(embedded.GET_JAVA_TEMPLATE_CLASS_OPTION)
if err == nil {
for _, javaClass := range javaPackage.Classes {
createJavaClassFile(javaClass, fs, classTemplate, storeFilePath)
}
log.Print("convertJavaPackageToJavaFiles: Creating enums")
enumTemplate, err := embedded.GetJavaEnumTemplate()
enumTemplate, err := embedded.GetJavaTemplate(embedded.GET_JAVA_TEMPLATE_ENUM_OPTION)
if err == nil {
for _, javaEnum := range javaPackage.Enums {
createJavaEnumFile(javaEnum, fs, enumTemplate, storeFilePath)
}
}
}

}

// TODO: Make errors output from these functions fatal
Expand Down
4 changes: 2 additions & 2 deletions openapi2beans/pkg/generator/package2java_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ const (
)

func getEmbeddedClassTemplate(t *testing.T) *mustache.Template {
classTemplate, err := embedded.GetJavaClassTemplate()
classTemplate, err := embedded.GetJavaTemplate(embedded.GET_JAVA_TEMPLATE_CLASS_OPTION)
assert.Nil(t, err)
return classTemplate
}

func getEmbeddedEnumTemplate(t *testing.T) *mustache.Template {
enumTemplate, err := embedded.GetJavaEnumTemplate()
enumTemplate, err := embedded.GetJavaTemplate(embedded.GET_JAVA_TEMPLATE_ENUM_OPTION)
assert.Nil(t, err)
return enumTemplate
}
Expand Down

0 comments on commit d8e5c1b

Please sign in to comment.