Skip to content

Commit 192e366

Browse files
daniel-scwing328
authored andcommitted
fixing wrong model file suffix when identical with model suffix (#1876)
relates to #1467
1 parent 832b4ef commit 192e366

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
import java.text.SimpleDateFormat;
3030
import java.util.*;
3131

32-
import static org.openapitools.codegen.utils.StringUtils.camelize;
33-
import static org.openapitools.codegen.utils.StringUtils.underscore;
34-
import static org.openapitools.codegen.utils.StringUtils.dashize;
32+
import static org.openapitools.codegen.utils.StringUtils.*;
3533

3634
public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCodegen {
3735
private static final Logger LOGGER = LoggerFactory.getLogger(TypeScriptAngularClientCodegen.class);
@@ -529,7 +527,7 @@ public String toApiImport(String name) {
529527

530528
@Override
531529
public String toModelFilename(String name) {
532-
return this.convertUsingFileNamingConvention(this.sanitizeName(name) + modelFileSuffix);
530+
return this.convertUsingFileNamingConvention(this.sanitizeName(name)) + modelFileSuffix;
533531
}
534532

535533
@Override
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package org.openapitools.codegen.typescript.typescriptangular;
2+
3+
import org.junit.Assert;
4+
import org.junit.Test;
5+
import org.openapitools.codegen.languages.TypeScriptAngularClientCodegen;
6+
7+
public class TypeScriptAngularClientCodegenTest {
8+
@Test
9+
public void testModelFileSuffix() {
10+
TypeScriptAngularClientCodegen codegen = new TypeScriptAngularClientCodegen();
11+
codegen.additionalProperties().put("modelFileSuffix", "MySuffix");
12+
codegen.additionalProperties().put("modelSuffix", "MySuffix");
13+
codegen.processOpts();
14+
15+
Assert.assertEquals(codegen.toModelFilename("testName"), "testNameMySuffix");
16+
}
17+
}

0 commit comments

Comments
 (0)