Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added option for kebab file naming for typescript-angular generator. #922

Merged
merged 1 commit into from
Jun 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
public static final String NG_VERSION = "ngVersion";
public static final String NG_PACKAGR = "useNgPackagr";
public static final String PROVIDED_IN_ROOT ="providedInRoot";
public static final String KEBAB_FILE_NAME ="kebab-file-name";

protected String npmName = null;
protected String npmVersion = "1.0.0";
protected String npmRepository = null;
protected boolean kebabFileNaming;

public TypeScriptAngularClientCodegen() {
super();
Expand Down Expand Up @@ -229,6 +231,8 @@ public void processOpts() {
}
}

kebabFileNaming = Boolean.parseBoolean(String.valueOf(additionalProperties.get(KEBAB_FILE_NAME)));

}

private SemVer determineNgVersion() {
Expand Down Expand Up @@ -496,6 +500,9 @@ public String toApiFilename(String name) {
if (name.length() == 0) {
return "default.service";
}
if (kebabFileNaming) {
return dashize(name);
}
return camelize(name, true) + ".service";
}

Expand All @@ -506,6 +513,9 @@ public String toApiImport(String name) {

@Override
public String toModelFilename(String name) {
if (kebabFileNaming) {
return dashize(name);
}
return camelize(toModelName(name), true);
}

Expand Down