Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions internal/jennies/golang/rawtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ func (jenny RawTypes) generateSchema(context languages.Context, schema *ast.Sche

customMethodsBlock := template.CustomObjectMethodsBlock(object)
if jenny.tmpl.Exists(customMethodsBlock) {
innerErr = jenny.tmpl.RenderInBuffer(&buffer, customMethodsBlock, map[string]any{
innerErr = jenny.tmpl.Funcs(map[string]any{
"formatPkg": func(pkg string) string {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not sticking with existing helper names?
See the builder.go jenny:

"importStdPkg": func(pkg string) string {
return imports.Add(pkg, pkg)
},

return imports.Add(pkg, pkg)
},
}).RenderInBuffer(&buffer, customMethodsBlock, map[string]any{
"Object": object,
})
if innerErr != nil {
Expand All @@ -125,7 +129,11 @@ func (jenny RawTypes) generateSchema(context languages.Context, schema *ast.Sche

customSchemaVariant := template.CustomSchemaVariantBlock(schema)
if jenny.tmpl.Exists(customSchemaVariant) {
if err := jenny.tmpl.RenderInBuffer(&buffer, customSchemaVariant, map[string]any{
if err := jenny.tmpl.Funcs(map[string]any{
"formatPkg": func(pkg string) string {
return imports.Add(pkg, pkg)
},
}).RenderInBuffer(&buffer, customSchemaVariant, map[string]any{
"Schema": schema,
"Config": jenny.config,
}); err != nil {
Expand Down
Loading