Skip to content

feat: add hasPrefix and hasSuffix template functions - #2659

Open
yakovlef wants to merge 1 commit into
oapi-codegen:mainfrom
yakovlef:template-has-prefix-suffix
Open

yakovlef wants to merge 1 commit into
oapi-codegen:mainfrom
yakovlef:template-has-prefix-suffix

Conversation

@yakovlef

@yakovlef yakovlef commented Nov 9, 2026

Copy link
Copy Markdown

Closes #1538

Adds hasPrefix and hasSuffix (strings.HasPrefix / strings.HasSuffix) to TemplateFunctions, so custom templates can check type names, eg {{ if hasSuffix .TypeName "Response" }}.

Old PR for this (deepmap#1539) was closed without merge, so picked it up again. Added a small test that runs both funcs through a template.

@yakovlef
yakovlef requested a review from a team as a code owner November 9, 2026 09:08
@greptile-apps

greptile-apps Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge.

Summary

Adds hasPrefix and hasSuffix to TemplateFunctions, backed by strings.HasPrefix and strings.HasSuffix.

  • Templates can check whether a name starts or ends with text.

Reviews (1) · Last reviewed commit: "feat: add hasPrefix and hasSuffix templa..." · Reviewed by Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add hasPrefix and hasSuffix template funcs

1 participant