Skip to content

Commit 2ea3816

Browse files
committed
Merge pull request #1290 from geekerzp/model_name
[Python, Ruby] Fix issues in python and ruby clients
2 parents baca302 + 2943f41 commit 2ea3816

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,8 @@ public String toParamName(String name) {
199199

200200
@Override
201201
public String toModelName(String name) {
202+
name = sanitizeName(name);
203+
202204
// model name cannot use reserved keyword, e.g. return
203205
if (reservedWords.contains(name)) {
204206
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/RubyClientCodegen.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ public String toParamName(String name) {
224224

225225
@Override
226226
public String toModelName(String name) {
227+
name = sanitizeName(name);
228+
227229
// model name cannot use reserved keyword, e.g. return
228230
if (reservedWords.contains(name)) {
229231
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");

samples/client/petstore/python/swagger_client/apis/user_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ def get_user_by_name(self, username, **kwargs):
435435
436436
:param callback function: The callback function
437437
for asynchronous request. (optional)
438-
:param str username: The name that needs to be fetched. Use user1 for testing. (required)
438+
:param str username: The name that needs to be fetched. Use user1 for testing. (required)
439439
:return: User
440440
If the method is called asynchronously,
441441
returns the request thread.

0 commit comments

Comments
 (0)