skip warning, better code format for jetbrain http client generator (#18299)

This commit is contained in:
William Cheng 2024-04-06 11:01:08 +08:00 committed by GitHub
parent 1024c7733e
commit ac14e66da1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -369,13 +369,14 @@ public class JetbrainsHttpClientClientCodegen extends DefaultCodegen implements
for (int i = 0; i < items.size(); i++) { for (int i = 0; i < items.size(); i++) {
jsonBuilder.append(JSON_ESCAPE_DOUBLE_QUOTE).append(items.get(i)).append(JSON_ESCAPE_DOUBLE_QUOTE); jsonBuilder.append(JSON_ESCAPE_DOUBLE_QUOTE).append(items.get(i)).append(JSON_ESCAPE_DOUBLE_QUOTE);
if (i < items.size() - 1) {jsonBuilder.append(",");} if (i < items.size() - 1) {
jsonBuilder.append(",");
}
} }
jsonBuilder.append("]"); jsonBuilder.append("]");
ret = ret + JSON_ESCAPE_DOUBLE_QUOTE + key + JSON_ESCAPE_DOUBLE_QUOTE + ": " + jsonBuilder; ret = ret + JSON_ESCAPE_DOUBLE_QUOTE + key + JSON_ESCAPE_DOUBLE_QUOTE + ": " + jsonBuilder;
} } else {
else {
LOGGER.warn("Value type unrecognised: " + value.getClass()); LOGGER.warn("Value type unrecognised: " + value.getClass());
//WARNING: here we are undoing what is done in "add comma unless last attribute" //WARNING: here we are undoing what is done in "add comma unless last attribute"
// This is meant to avoid dangling commas if we encounter an unknown type // This is meant to avoid dangling commas if we encounter an unknown type
@ -394,4 +395,13 @@ public class JetbrainsHttpClientClientCodegen extends DefaultCodegen implements
return ret; return ret;
} }
@Override
public String escapeUnsafeCharacters(String input) {
return input;
}
@Override
public String escapeQuotationMark(String input) {
return input;
}
} }