Skip to content

Commit

Permalink
Add class prefix to tag with numbers (#6561)
Browse files Browse the repository at this point in the history
* add class prefix to tag with numbers, update java to default tag name

* update codegen test
  • Loading branch information
wing328 authored Sep 25, 2017
1 parent 672cc29 commit 419ee1c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3502,7 +3502,7 @@ public String sanitizeTag(String tag) {

// tag starts with numbers
if (tag.matches("^\\d.*")) {
tag = "_" + tag;
tag = "Class" + tag;
}

return tag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1229,11 +1229,6 @@ public void writePropertyBack(String propertyKey, boolean value) {
additionalProperties.put(propertyKey, value);
}

@Override
public String sanitizeTag(String tag) {
return camelize(sanitizeName(tag));
}

/**
* Output the Getter name for boolean property, e.g. isActive
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ public class CodegenTest {
public void sanitizeTagTest() {
final DefaultCodegen codegen = new DefaultCodegen();
Assert.assertEquals(codegen.sanitizeTag("foo"), "Foo");
Assert.assertEquals(codegen.sanitizeTag("$foo!"), "Foo");
Assert.assertEquals(codegen.sanitizeTag("foo bar"), "FooBar");
Assert.assertEquals(codegen.sanitizeTag("foo_bar"), "FooBar");
Assert.assertEquals(codegen.sanitizeTag("foo1 bar2"), "Foo1Bar2");
Assert.assertEquals(codegen.sanitizeTag("foo bar 1"), "FooBar1");
Assert.assertEquals(codegen.sanitizeTag("1foo"), "_1foo");
Assert.assertEquals(codegen.sanitizeTag("1foo"), "Class1foo");
}

@Test(description = "test camelize")
Expand Down

0 comments on commit 419ee1c

Please sign in to comment.