Skip to content

Commit a36fd69

Browse files
authored
Merge pull request #875 from poculeka/enable-kotlin-client-helpers
Enable StringHelpers Handlebars in Kotlin client codegen
2 parents a2ffea4 + 8f55f7e commit a36fd69

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/main/java/io/swagger/codegen/v3/generators/kotlin/AbstractKotlinCodegen.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import io.swagger.v3.oas.models.media.Schema;
1212
import org.slf4j.Logger;
1313
import org.slf4j.LoggerFactory;
14+
import com.github.jknack.handlebars.helper.StringHelpers;
15+
import com.github.jknack.handlebars.Handlebars;
1416

1517
import java.io.File;
1618
import java.util.Arrays;
@@ -506,6 +508,12 @@ public String toVarName(String name) {
506508
return super.toVarName(sanitizeKotlinSpecificNames(name));
507509
}
508510

511+
@Override
512+
public void addHandlebarHelpers(Handlebars handlebars) {
513+
super.addHandlebarHelpers(handlebars);
514+
handlebars.registerHelpers(StringHelpers.class);
515+
}
516+
509517
/**
510518
* Provides a strongly typed declaration for simple arrays of some type and arrays of arrays of some type.
511519
*

src/main/java/io/swagger/codegen/v3/generators/kotlin/KotlinServerCodegen.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
import java.util.Arrays;
1919
import java.util.List;
2020
import java.util.Map;
21-
import com.github.jknack.handlebars.helper.StringHelpers;
22-
import com.github.jknack.handlebars.Handlebars;
2321
import org.apache.commons.lang3.StringUtils;
2422

2523
import static java.util.Collections.singletonMap;
@@ -228,12 +226,6 @@ public void processOpts() {
228226
supportingFiles.add(new SupportingFile("ApiKeyAuth.kt.mustache", infrastructureFolder, "ApiKeyAuth.kt"));
229227
}
230228

231-
@Override
232-
public void addHandlebarHelpers(Handlebars handlebars) {
233-
super.addHandlebarHelpers(handlebars);
234-
handlebars.registerHelpers(StringHelpers.class);
235-
}
236-
237229
@Override
238230
public String getDefaultTemplateDir() {
239231
return "kotlin-server";

0 commit comments

Comments
 (0)