-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better handling of operationID starting with numbers #691
Changes from all commits
5be1ef1
acfbf93
c594079
a1f26ef
4b0fa8b
f240570
1648871
0257626
c18634e
6cb657a
7e5e6c7
5484bfd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -603,6 +603,12 @@ public String toOperationId(String operationId) { | |
operationId = "call_" + operationId; | ||
} | ||
|
||
// operationId starts with a number | ||
if (operationId.matches("^\\d.*")) { | ||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId))); | ||
operationId = "call_" + operationId; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. still not sanitizing here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure to understand, this is just about adding the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh my bad, didnt see that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jmini is correct. It was already sanitized a few lines above and that's the reason why I didn't call the function |
||
} | ||
|
||
return camelize(sanitizeName(operationId)); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -377,8 +377,14 @@ public String toOperationId(String operationId) { | |
|
||
// method name cannot use reserved keyword, e.g. return | ||
if (isReservedWord(operationId)) { | ||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore("call_" + operationId)); | ||
return underscore("call_" + operationId); | ||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId))); | ||
return underscore(sanitizeName("call_" + operationId)); | ||
} | ||
|
||
// operationId starts with a number | ||
if (operationId.matches("^\\d.*")) { | ||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId))); | ||
operationId = "call_" + operationId; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. still not sanitizing here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. didnt see sanitization on returning value |
||
} | ||
|
||
//return underscore(operationId).replaceAll("[^A-Za-z0-9_]", ""); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -552,7 +552,7 @@ public String toOperationId(String operationId) { | |
operationId = "call_" + operationId; | ||
} | ||
|
||
// model name starts with a number | ||
// operationId starts with a number | ||
if (operationId.matches("^\\d.*")) { | ||
LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId))); | ||
operationId = "call_" + operationId; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. still not sanitizing here |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.1.1-SNAPSHOT | ||
3.2.0-SNAPSHOT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still not sanitizing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvm