File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -456,6 +456,11 @@ var reservedWordsInAttr = map[string]string{
456456 "string" : "astring" ,
457457}
458458
459+ var specialCharacterMapping = map [string ]string {
460+ "+" : "Plus" ,
461+ "@" : "At" ,
462+ }
463+
459464// Replaces Go reserved keywords to avoid compilation issues
460465func replaceReservedWords (identifier string ) string {
461466 value := reservedWords [identifier ]
@@ -476,8 +481,12 @@ func replaceAttrReservedWords(identifier string) string {
476481
477482// Normalizes value to be used as a valid Go identifier, avoiding compilation issues
478483func normalize (value string ) string {
484+ for k , v := range specialCharacterMapping {
485+ value = strings .ReplaceAll (value , k , v )
486+ }
487+
479488 mapping := func (r rune ) rune {
480- if r == '.' {
489+ if r == '.' || r == '-' {
481490 return '_'
482491 }
483492 if unicode .IsLetter (r ) || unicode .IsDigit (r ) || r == '_' {
@@ -490,7 +499,7 @@ func normalize(value string) string {
490499}
491500
492501func goString (s string ) string {
493- return strings .Replace (s , "\" " , "\\ \" " , - 1 )
502+ return strings .ReplaceAll (s , "\" " , "\\ \" " )
494503}
495504
496505var xsd2GoTypes = map [string ]string {
You can’t perform that action at this time.
0 commit comments