[htmlDocs2] inconsistent python method name between html2 and python generator (#5711)

This commit is contained in:
Takuro Wada 2017-05-26 18:24:06 +09:00 committed by wing328
parent 84df23f025
commit a2240ac619
5 changed files with 24 additions and 21 deletions

View File

@ -37,6 +37,7 @@ public class CodegenOperation {
public String nickname; // legacy support
public String operationIdLowerCase; // for mardown documentation
public String operationIdCamelCase; // for class names
public String operationIdSnakeCase;
/**
* Check if there's at least one parameter

View File

@ -2888,6 +2888,7 @@ public class DefaultCodegen {
co.operationId = uniqueName;
co.operationIdLowerCase = uniqueName.toLowerCase();
co.operationIdCamelCase = DefaultCodegen.camelize(uniqueName);
co.operationIdSnakeCase = DefaultCodegen.underscore(uniqueName);
opList.add(co);
co.baseName = tag;
}

View File

@ -22,7 +22,7 @@ api_instance = {{{pythonPackageName}}}.{{{classname}}}()
try:
{{#summary}} # {{{.}}}
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationIdSnakeCase}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
pprint(api_response){{/returnType}}
except ApiException as e:
print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e)

View File

@ -0,0 +1 @@
2.2.3-SNAPSHOT

View File

@ -1200,7 +1200,7 @@ body = # Pet | Pet object that needs to be added to the store
try:
# Add a new pet to the store
api_instance.addPet(body)
api_instance.add_pet(body)
except ApiException as e:
print("Exception when calling PetApi->addPet: %s\n" % e)</code></pre>
</div>
@ -1498,7 +1498,7 @@ apiKey = apiKey_example # String | (optional)
try:
# Deletes a pet
api_instance.deletePet(petId, apiKey=apiKey)
api_instance.delete_pet(petId, apiKey=apiKey)
except ApiException as e:
print("Exception when calling PetApi->deletePet: %s\n" % e)</code></pre>
</div>
@ -1831,7 +1831,7 @@ status = # array[String] | Status values that need to be considered for filter
try:
# Finds Pets by status
api_response = api_instance.findPetsByStatus(status)
api_response = api_instance.find_pets_by_status(status)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->findPetsByStatus: %s\n" % e)</code></pre>
@ -2177,7 +2177,7 @@ tags = # array[String] | Tags to filter by
try:
# Finds Pets by tags
api_response = api_instance.findPetsByTags(tags)
api_response = api_instance.find_pets_by_tags(tags)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->findPetsByTags: %s\n" % e)</code></pre>
@ -2535,7 +2535,7 @@ petId = 789 # Long | ID of pet to return
try:
# Find pet by ID
api_response = api_instance.getPetById(petId)
api_response = api_instance.get_pet_by_id(petId)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->getPetById: %s\n" % e)</code></pre>
@ -2873,7 +2873,7 @@ body = # Pet | Pet object that needs to be added to the store
try:
# Update an existing pet
api_instance.updatePet(body)
api_instance.update_pet(body)
except ApiException as e:
print("Exception when calling PetApi->updatePet: %s\n" % e)</code></pre>
</div>
@ -3196,7 +3196,7 @@ status = status_example # String | Updated status of the pet (optional)
try:
# Updates a pet in the store with form data
api_instance.updatePetWithForm(petId, name=name, status=status)
api_instance.update_pet_with_form(petId, name=name, status=status)
except ApiException as e:
print("Exception when calling PetApi->updatePetWithForm: %s\n" % e)</code></pre>
</div>
@ -3583,7 +3583,7 @@ file = /path/to/file.txt # File | file to upload (optional)
try:
# uploads an image
api_response = api_instance.uploadFile(petId, additionalMetadata=additionalMetadata, file=file)
api_response = api_instance.upload_file(petId, additionalMetadata=additionalMetadata, file=file)
pprint(api_response)
except ApiException as e:
print("Exception when calling PetApi->uploadFile: %s\n" % e)</code></pre>
@ -3954,7 +3954,7 @@ orderId = orderId_example # String | ID of the order that needs to be deleted
try:
# Delete purchase order by ID
api_instance.deleteOrder(orderId)
api_instance.delete_order(orderId)
except ApiException as e:
print("Exception when calling StoreApi->deleteOrder: %s\n" % e)</code></pre>
</div>
@ -4259,7 +4259,7 @@ api_instance = swagger_client.StoreApi()
try:
# Returns pet inventories by status
api_response = api_instance.getInventory()
api_response = api_instance.get_inventory()
pprint(api_response)
except ApiException as e:
print("Exception when calling StoreApi->getInventory: %s\n" % e)</code></pre>
@ -4525,7 +4525,7 @@ orderId = 789 # Long | ID of pet that needs to be fetched
try:
# Find purchase order by ID
api_response = api_instance.getOrderById(orderId)
api_response = api_instance.get_order_by_id(orderId)
pprint(api_response)
except ApiException as e:
print("Exception when calling StoreApi->getOrderById: %s\n" % e)</code></pre>
@ -4846,7 +4846,7 @@ body = # Order | order placed for purchasing the pet
try:
# Place an order for a pet
api_response = api_instance.placeOrder(body)
api_response = api_instance.place_order(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling StoreApi->placeOrder: %s\n" % e)</code></pre>
@ -5153,7 +5153,7 @@ body = # User | Created user object
try:
# Create user
api_instance.createUser(body)
api_instance.create_user(body)
except ApiException as e:
print("Exception when calling UserApi->createUser: %s\n" % e)</code></pre>
</div>
@ -5413,7 +5413,7 @@ body = # array[User] | List of user object
try:
# Creates list of users with given input array
api_instance.createUsersWithArrayInput(body)
api_instance.create_users_with_array_input(body)
except ApiException as e:
print("Exception when calling UserApi->createUsersWithArrayInput: %s\n" % e)</code></pre>
</div>
@ -5676,7 +5676,7 @@ body = # array[User] | List of user object
try:
# Creates list of users with given input array
api_instance.createUsersWithListInput(body)
api_instance.create_users_with_list_input(body)
except ApiException as e:
print("Exception when calling UserApi->createUsersWithListInput: %s\n" % e)</code></pre>
</div>
@ -5939,7 +5939,7 @@ username = username_example # String | The name that needs to be deleted
try:
# Delete user
api_instance.deleteUser(username)
api_instance.delete_user(username)
except ApiException as e:
print("Exception when calling UserApi->deleteUser: %s\n" % e)</code></pre>
</div>
@ -6213,7 +6213,7 @@ username = username_example # String | The name that needs to be fetched. Use us
try:
# Get user by user name
api_response = api_instance.getUserByName(username)
api_response = api_instance.get_user_by_name(username)
pprint(api_response)
except ApiException as e:
print("Exception when calling UserApi->getUserByName: %s\n" % e)</code></pre>
@ -6541,7 +6541,7 @@ password = password_example # String | The password for login in clear text
try:
# Logs user into the system
api_response = api_instance.loginUser(username, password)
api_response = api_instance.login_user(username, password)
pprint(api_response)
except ApiException as e:
print("Exception when calling UserApi->loginUser: %s\n" % e)</code></pre>
@ -6903,7 +6903,7 @@ api_instance = swagger_client.UserApi()
try:
# Logs out current logged in user session
api_instance.logoutUser()
api_instance.logout_user()
except ApiException as e:
print("Exception when calling UserApi->logoutUser: %s\n" % e)</code></pre>
</div>
@ -7131,7 +7131,7 @@ body = # User | Updated user object
try:
# Updated user
api_instance.updateUser(username, body)
api_instance.update_user(username, body)
except ApiException as e:
print("Exception when calling UserApi->updateUser: %s\n" % e)</code></pre>
</div>