forked from loafle/openapi-generator-original
remove reserved word check in lambda
This commit is contained in:
@@ -72,16 +72,6 @@ public class CamelCaseLambda implements Mustache.Lambda {
|
||||
String text = camelize(fragment.execute().replace(" ", "_"), option);
|
||||
if (generator != null) {
|
||||
text = generator.sanitizeName(text);
|
||||
if (generator.reservedWords().contains(text)) {
|
||||
// Escaping must be done *after* camelize, because generators may escape using characters removed by camelize function.
|
||||
text = generator.escapeReservedWord(text);
|
||||
}
|
||||
|
||||
if (escapeParam) {
|
||||
// NOTE: many generators call escapeReservedWord in toParamName, but we can't assume that's always the case.
|
||||
// Here, we'll have to accept that we may be duplicating some work.
|
||||
text = generator.toParamName(text);
|
||||
}
|
||||
}
|
||||
writer.write(text);
|
||||
}
|
||||
|
||||
@@ -40,10 +40,6 @@ public class CaseFormatLambda implements Mustache.Lambda {
|
||||
@Override
|
||||
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
|
||||
String text = initialFormat.converterTo(targetFormat).convert(fragment.execute());
|
||||
if (generator != null && generator.reservedWords().contains(text)) {
|
||||
text = generator.escapeReservedWord(text);
|
||||
}
|
||||
|
||||
if (text != null) {
|
||||
writer.write(text);
|
||||
}
|
||||
|
||||
@@ -53,9 +53,6 @@ public class LowercaseLambda implements Mustache.Lambda {
|
||||
@Override
|
||||
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
|
||||
String text = fragment.execute().toLowerCase(Locale.ROOT);
|
||||
if (generator != null && generator.reservedWords().contains(text)) {
|
||||
text = generator.escapeReservedWord(text);
|
||||
}
|
||||
writer.write(text);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user