Skip to content

Commit

Permalink
Merge pull request swagger-api#875 from poculeka/enable-kotlin-client…
Browse files Browse the repository at this point in the history
…-helpers

Enable StringHelpers Handlebars in Kotlin client codegen
  • Loading branch information
HugoMario authored Jun 30, 2021
2 parents a2ffea4 + 8f55f7e commit a36fd69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import io.swagger.v3.oas.models.media.Schema;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.jknack.handlebars.helper.StringHelpers;
import com.github.jknack.handlebars.Handlebars;

import java.io.File;
import java.util.Arrays;
Expand Down Expand Up @@ -506,6 +508,12 @@ public String toVarName(String name) {
return super.toVarName(sanitizeKotlinSpecificNames(name));
}

@Override
public void addHandlebarHelpers(Handlebars handlebars) {
super.addHandlebarHelpers(handlebars);
handlebars.registerHelpers(StringHelpers.class);
}

/**
* Provides a strongly typed declaration for simple arrays of some type and arrays of arrays of some type.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.github.jknack.handlebars.helper.StringHelpers;
import com.github.jknack.handlebars.Handlebars;
import org.apache.commons.lang3.StringUtils;

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

@Override
public void addHandlebarHelpers(Handlebars handlebars) {
super.addHandlebarHelpers(handlebars);
handlebars.registerHelpers(StringHelpers.class);
}

@Override
public String getDefaultTemplateDir() {
return "kotlin-server";
Expand Down

0 comments on commit a36fd69

Please sign in to comment.