forked from loafle/openapi-generator-original
fix empty operationId
This commit is contained in:
parent
31200acc1a
commit
d0baa48fcd
@ -1278,10 +1278,9 @@ public class DefaultCodegen {
|
|||||||
} else {
|
} else {
|
||||||
m.emptyVars = true;
|
m.emptyVars = true;
|
||||||
}
|
}
|
||||||
} public static String camelize(String word) {
|
|
||||||
return camelize(word, false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove characters not suitable for variable or method name from the input and camelize it
|
* Remove characters not suitable for variable or method name from the input and camelize it
|
||||||
*
|
*
|
||||||
@ -1301,7 +1300,18 @@ public class DefaultCodegen {
|
|||||||
name = name.substring(0, 1).toLowerCase() + name.substring(1);
|
name = name.substring(0, 1).toLowerCase() + name.substring(1);
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
} public static String camelize(String word, boolean lowercaseFirstLetter) {
|
}
|
||||||
|
|
||||||
|
public static String camelize(String word) {
|
||||||
|
return camelize(word, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String camelize(String word, boolean lowercaseFirstLetter) {
|
||||||
|
// throw exception if method name is empty
|
||||||
|
if (StringUtils.isEmpty(word)) {
|
||||||
|
throw new RuntimeException("Empty method name (operationId) not allowed");
|
||||||
|
}
|
||||||
|
|
||||||
// Replace all slashes with dots (package separator)
|
// Replace all slashes with dots (package separator)
|
||||||
Pattern p = Pattern.compile("\\/(.?)");
|
Pattern p = Pattern.compile("\\/(.?)");
|
||||||
Matcher m = p.matcher(word);
|
Matcher m = p.matcher(word);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user