mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-08 19:33:55 +00:00
Merge pull request #1290 from geekerzp/model_name
[Python, Ruby] Fix issues in python and ruby clients
This commit is contained in:
commit
2ea3816e65
@ -199,6 +199,8 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toModelName(String name) {
|
public String toModelName(String name) {
|
||||||
|
name = sanitizeName(name);
|
||||||
|
|
||||||
// model name cannot use reserved keyword, e.g. return
|
// model name cannot use reserved keyword, e.g. return
|
||||||
if (reservedWords.contains(name)) {
|
if (reservedWords.contains(name)) {
|
||||||
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");
|
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");
|
||||||
|
@ -224,6 +224,8 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toModelName(String name) {
|
public String toModelName(String name) {
|
||||||
|
name = sanitizeName(name);
|
||||||
|
|
||||||
// model name cannot use reserved keyword, e.g. return
|
// model name cannot use reserved keyword, e.g. return
|
||||||
if (reservedWords.contains(name)) {
|
if (reservedWords.contains(name)) {
|
||||||
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");
|
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");
|
||||||
|
Loading…
Reference in New Issue
Block a user