|
|
@ -975,37 +975,27 @@ class OpenAPIBuilder implements Builder { |
|
|
|
String _clientName(final String tag) => '${_toDartName(tag, uppercaseFirstCharacter: true)}Client'; |
|
|
|
String _clientName(final String tag) => '${_toDartName(tag, uppercaseFirstCharacter: true)}Client'; |
|
|
|
|
|
|
|
|
|
|
|
String _toDartName( |
|
|
|
String _toDartName( |
|
|
|
final String input, { |
|
|
|
final String name, { |
|
|
|
final bool uppercaseFirstCharacter = false, |
|
|
|
final bool uppercaseFirstCharacter = false, |
|
|
|
}) { |
|
|
|
}) { |
|
|
|
final result = StringBuffer(); |
|
|
|
var result = ''; |
|
|
|
|
|
|
|
var upperCase = uppercaseFirstCharacter; |
|
|
|
final parts = input.split(''); |
|
|
|
var firstCharacter = !uppercaseFirstCharacter; |
|
|
|
for (var i = 0; i < parts.length; i++) { |
|
|
|
for (final char in name.split('')) { |
|
|
|
var char = parts[i]; |
|
|
|
|
|
|
|
final prevChar = i > 0 ? parts[i - 1] : null; |
|
|
|
|
|
|
|
if (_isNonAlphaNumericString(char)) { |
|
|
|
if (_isNonAlphaNumericString(char)) { |
|
|
|
continue; |
|
|
|
upperCase = true; |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (prevChar != null && _isNonAlphaNumericString(prevChar)) { |
|
|
|
result += firstCharacter ? char.toLowerCase() : (upperCase ? char.toUpperCase() : char); |
|
|
|
char = char.toUpperCase(); |
|
|
|
upperCase = false; |
|
|
|
} |
|
|
|
firstCharacter = false; |
|
|
|
if (i == 0) { |
|
|
|
|
|
|
|
if (uppercaseFirstCharacter) { |
|
|
|
|
|
|
|
char = char.toUpperCase(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
char = char.toLowerCase(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
result.write(char); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final out = result.toString(); |
|
|
|
if (_dartKeywords.contains(result) || RegExp(r'^[0-9]+$', multiLine: true).hasMatch(result)) { |
|
|
|
if (_dartKeywords.contains(out) || RegExp(r'^[0-9]+$', multiLine: true).hasMatch(out)) { |
|
|
|
return '\$$result'; |
|
|
|
return '\$$out'; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return out; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
final _dartKeywords = [ |
|
|
|
final _dartKeywords = [ |
|
|
|