File tree Expand file tree Collapse file tree 1 file changed +57
-35
lines changed
modules/swagger-codegen/src/main/java/io/swagger/codegen/languages Expand file tree Collapse file tree 1 file changed +57
-35
lines changed Original file line number Diff line number Diff line change @@ -17,77 +17,90 @@ public AbstractCppCodegen() {
17
17
*/
18
18
setReservedWordsLowerCase (
19
19
Arrays .asList (
20
+ "alignas" ,
21
+ "alignof" ,
22
+ "and" ,
23
+ "and_eq" ,
24
+ "asm" ,
20
25
"auto" ,
26
+ "bitand" ,
27
+ "bitor" ,
28
+ "bool" ,
21
29
"break" ,
22
30
"case" ,
31
+ "catch" ,
23
32
"char" ,
33
+ "char16_t" ,
34
+ "char32_t" ,
35
+ "class" ,
36
+ "compl" ,
37
+ "concept" ,
24
38
"const" ,
39
+ "constexpr" ,
40
+ "const_cast" ,
25
41
"continue" ,
42
+ "decltype" ,
26
43
"default" ,
44
+ "delete" ,
27
45
"do" ,
28
46
"double" ,
47
+ "dynamic_cast" ,
29
48
"else" ,
30
49
"enum" ,
50
+ "explicit" ,
51
+ "export" ,
31
52
"extern" ,
53
+ "false" ,
32
54
"float" ,
33
55
"for" ,
56
+ "friend" ,
34
57
"goto" ,
35
58
"if" ,
59
+ "inline" ,
36
60
"int" ,
37
61
"long" ,
38
- "register" ,
39
- "return" ,
40
- "short" ,
41
- "signed" ,
42
- "sizeof" ,
43
- "static" ,
44
- "struct" ,
45
- "switch" ,
46
- "typedef" ,
47
- "union" ,
48
- "unsigned" ,
49
- "void" ,
50
- "volatile" ,
51
- "while" ,
52
- "asm" ,
53
- "bool" ,
54
- "catch" ,
55
- "class" ,
56
- "const_cast" ,
57
- "delete" ,
58
- "dynamic_cast" ,
59
- "explicit" ,
60
- "false" ,
61
- "friend" ,
62
- "inline" ,
63
62
"mutable" ,
64
63
"namespace" ,
65
64
"new" ,
65
+ "noexcept" ,
66
+ "not" ,
67
+ "not_eq" ,
68
+ "nullptr" ,
66
69
"operator" ,
70
+ "or" ,
71
+ "or_eq" ,
67
72
"private" ,
68
- "public" ,
69
73
"protected" ,
74
+ "public" ,
75
+ "register" ,
70
76
"reinterpret_cast" ,
77
+ "requires" ,
78
+ "return" ,
79
+ "short" ,
80
+ "signed" ,
81
+ "sizeof" ,
82
+ "static" ,
83
+ "static_assert" ,
71
84
"static_cast" ,
85
+ "struct" ,
86
+ "switch" ,
72
87
"template" ,
73
88
"this" ,
89
+ "thread_local" ,
74
90
"throw" ,
75
91
"true" ,
76
92
"try" ,
93
+ "typedef" ,
77
94
"typeid" ,
78
95
"typename" ,
96
+ "union" ,
97
+ "unsigned" ,
79
98
"using" ,
80
99
"virtual" ,
100
+ "void" ,
101
+ "volatile" ,
81
102
"wchar_t" ,
82
- "and" ,
83
- "and_eq" ,
84
- "bitand" ,
85
- "bitor" ,
86
- "compl" ,
87
- "not" ,
88
- "not_eq" ,
89
- "or" ,
90
- "or_eq" ,
103
+ "while" ,
91
104
"xor" ,
92
105
"xor_eq" )
93
106
);
@@ -127,6 +140,15 @@ public String escapeReservedWord(String name) {
127
140
return sanitizeName ("_" + name );
128
141
}
129
142
143
+ @ Override
144
+ public String toOperationId (String operationId ) {
145
+ if (isReservedWord (operationId )) {
146
+ LOGGER .warn (operationId + " (reserved word) cannot be used as method name. Renamed to " + escapeReservedWord (operationId ));
147
+ return escapeReservedWord (operationId );
148
+ }
149
+ return sanitizeName (super .toOperationId (operationId ));
150
+ }
151
+
130
152
@ Override
131
153
public String toParamName (String name ) {
132
154
return sanitizeName (super .toParamName (name ));
You can’t perform that action at this time.
0 commit comments