Skip to content

Commit 0a9c6f5

Browse files
JFCotewing328
authored andcommitted
Fix issue #7262 with the parameter name in the path. The problem was that camelCase naming was forced only in this part of the code when everywhere else it is configurable. (#7313)
1 parent 6c2a583 commit 0a9c6f5

File tree

6 files changed

+11
-24
lines changed

6 files changed

+11
-24
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngularClientCodegen.java

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package io.swagger.codegen.languages;
22

33
import java.io.File;
4-
import java.lang.StringBuffer;
54
import java.text.SimpleDateFormat;
65
import java.util.ArrayList;
76
import java.util.Date;
@@ -258,11 +257,9 @@ public Map<String, Object> postProcessOperations(Map<String, Object> operations)
258257
}
259258

260259
// Prep a string buffer where we're going to set up our new version of the string.
261-
StringBuffer pathBuffer = new StringBuffer();
262-
263-
// Set up other variables for tracking the current state of the string.
260+
StringBuilder pathBuffer = new StringBuilder();
261+
StringBuilder parameterName = new StringBuilder();
264262
int insideCurly = 0;
265-
boolean foundUnderscore = false;
266263

267264
// Iterate through existing string, one character at a time.
268265
for (int i = 0; i < op.path.length(); i++) {
@@ -279,23 +276,13 @@ public Map<String, Object> postProcessOperations(Map<String, Object> operations)
279276
insideCurly--;
280277

281278
// Add the more complicated component instead of just the brace.
279+
pathBuffer.append(toVarName(parameterName.toString()));
282280
pathBuffer.append("))}");
283-
break;
284-
case '_':
285-
// If we're inside the curly brace, the following character will need to be uppercase.
286-
// Otherwise, just add the character.
287-
if (insideCurly > 0) {
288-
foundUnderscore = true;
289-
} else {
290-
pathBuffer.append(op.path.charAt(i));
291-
}
281+
parameterName.setLength(0);
292282
break;
293283
default:
294-
// If we previously found an underscore, we need an uppercase letter.
295-
// Otherwise, just add the character.
296-
if (foundUnderscore) {
297-
pathBuffer.append(Character.toUpperCase(op.path.charAt(i)));
298-
foundUnderscore = false;
284+
if (insideCurly > 0) {
285+
parameterName.append(op.path.charAt(i));
299286
} else {
300287
pathBuffer.append(op.path.charAt(i));
301288
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0-SNAPSHOT
1+
2.3.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0-SNAPSHOT
1+
2.3.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0-SNAPSHOT
1+
2.3.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0-SNAPSHOT
1+
2.3.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0-SNAPSHOT
1+
2.3.0

0 commit comments

Comments
 (0)