fixing wrong model file suffix when identical with model suffix (#1876)

relates to #1467
This commit is contained in:
Daniel Schreiber
2019-01-16 11:23:14 +01:00
committed by William Cheng
parent 832b4ef512
commit 192e366bff
2 changed files with 19 additions and 4 deletions

View File

@@ -29,9 +29,7 @@ import java.io.File;
import java.text.SimpleDateFormat;
import java.util.*;
import static org.openapitools.codegen.utils.StringUtils.camelize;
import static org.openapitools.codegen.utils.StringUtils.underscore;
import static org.openapitools.codegen.utils.StringUtils.dashize;
import static org.openapitools.codegen.utils.StringUtils.*;
public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCodegen {
private static final Logger LOGGER = LoggerFactory.getLogger(TypeScriptAngularClientCodegen.class);
@@ -529,7 +527,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
@Override
public String toModelFilename(String name) {
return this.convertUsingFileNamingConvention(this.sanitizeName(name) + modelFileSuffix);
return this.convertUsingFileNamingConvention(this.sanitizeName(name)) + modelFileSuffix;
}
@Override

View File

@@ -0,0 +1,17 @@
package org.openapitools.codegen.typescript.typescriptangular;
import org.junit.Assert;
import org.junit.Test;
import org.openapitools.codegen.languages.TypeScriptAngularClientCodegen;
public class TypeScriptAngularClientCodegenTest {
@Test
public void testModelFileSuffix() {
TypeScriptAngularClientCodegen codegen = new TypeScriptAngularClientCodegen();
codegen.additionalProperties().put("modelFileSuffix", "MySuffix");
codegen.additionalProperties().put("modelSuffix", "MySuffix");
codegen.processOpts();
Assert.assertEquals(codegen.toModelFilename("testName"), "testNameMySuffix");
}
}