forked from loafle/openapi-generator-original
fix required parameters check for php
This commit is contained in:
parent
303378c5eb
commit
93e4ef0eec
@ -39,6 +39,12 @@ class {{classname}} {
|
|||||||
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
||||||
*/
|
*/
|
||||||
public function {{nickname}}({{#allParams}}${{paramName}}{{#optional}}=null{{/optional}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
|
public function {{nickname}}({{#allParams}}${{paramName}}{{#optional}}=null{{/optional}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
|
||||||
|
{{#allParams}}{{#required}}
|
||||||
|
// verify the required parameter '{{paramName}}' is set
|
||||||
|
if (${{paramName}} === null) {
|
||||||
|
throw new \Exception("Missing the required parameter ${{paramName}} when calling {{nickname}}");
|
||||||
|
}
|
||||||
|
{{/required}}{{/allParams}}
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "{{path}}";
|
$resourcePath = "{{path}}";
|
||||||
|
@ -39,6 +39,7 @@ class PetApi {
|
|||||||
*/
|
*/
|
||||||
public function updatePet($body) {
|
public function updatePet($body) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/pet";
|
$resourcePath = "/pet";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -92,6 +93,7 @@ class PetApi {
|
|||||||
*/
|
*/
|
||||||
public function addPet($body) {
|
public function addPet($body) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/pet";
|
$resourcePath = "/pet";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -145,6 +147,7 @@ class PetApi {
|
|||||||
*/
|
*/
|
||||||
public function findPetsByStatus($status) {
|
public function findPetsByStatus($status) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/pet/findByStatus";
|
$resourcePath = "/pet/findByStatus";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -203,6 +206,7 @@ class PetApi {
|
|||||||
*/
|
*/
|
||||||
public function findPetsByTags($tags) {
|
public function findPetsByTags($tags) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/pet/findByTags";
|
$resourcePath = "/pet/findByTags";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -261,6 +265,12 @@ class PetApi {
|
|||||||
*/
|
*/
|
||||||
public function getPetById($pet_id) {
|
public function getPetById($pet_id) {
|
||||||
|
|
||||||
|
// verify the required parameter 'pet_id' is set
|
||||||
|
if ($pet_id === null) {
|
||||||
|
throw new \Exception("Missing the required parameter $pet_id when calling getPetById");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/pet/{petId}";
|
$resourcePath = "/pet/{petId}";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -322,6 +332,12 @@ class PetApi {
|
|||||||
*/
|
*/
|
||||||
public function updatePetWithForm($pet_id, $name, $status) {
|
public function updatePetWithForm($pet_id, $name, $status) {
|
||||||
|
|
||||||
|
// verify the required parameter 'pet_id' is set
|
||||||
|
if ($pet_id === null) {
|
||||||
|
throw new \Exception("Missing the required parameter $pet_id when calling updatePetWithForm");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/pet/{petId}";
|
$resourcePath = "/pet/{petId}";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -382,6 +398,12 @@ class PetApi {
|
|||||||
*/
|
*/
|
||||||
public function deletePet($api_key, $pet_id) {
|
public function deletePet($api_key, $pet_id) {
|
||||||
|
|
||||||
|
// verify the required parameter 'pet_id' is set
|
||||||
|
if ($pet_id === null) {
|
||||||
|
throw new \Exception("Missing the required parameter $pet_id when calling deletePet");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/pet/{petId}";
|
$resourcePath = "/pet/{petId}";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -440,6 +462,12 @@ class PetApi {
|
|||||||
*/
|
*/
|
||||||
public function uploadFile($pet_id, $additional_metadata, $file) {
|
public function uploadFile($pet_id, $additional_metadata, $file) {
|
||||||
|
|
||||||
|
// verify the required parameter 'pet_id' is set
|
||||||
|
if ($pet_id === null) {
|
||||||
|
throw new \Exception("Missing the required parameter $pet_id when calling uploadFile");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/pet/{petId}/uploadImage";
|
$resourcePath = "/pet/{petId}/uploadImage";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
|
@ -38,6 +38,7 @@ class StoreApi {
|
|||||||
*/
|
*/
|
||||||
public function getInventory() {
|
public function getInventory() {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/store/inventory";
|
$resourcePath = "/store/inventory";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -93,6 +94,7 @@ class StoreApi {
|
|||||||
*/
|
*/
|
||||||
public function placeOrder($body) {
|
public function placeOrder($body) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/store/order";
|
$resourcePath = "/store/order";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -152,6 +154,12 @@ class StoreApi {
|
|||||||
*/
|
*/
|
||||||
public function getOrderById($order_id) {
|
public function getOrderById($order_id) {
|
||||||
|
|
||||||
|
// verify the required parameter 'order_id' is set
|
||||||
|
if ($order_id === null) {
|
||||||
|
throw new \Exception("Missing the required parameter $order_id when calling getOrderById");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/store/order/{orderId}";
|
$resourcePath = "/store/order/{orderId}";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -211,6 +219,12 @@ class StoreApi {
|
|||||||
*/
|
*/
|
||||||
public function deleteOrder($order_id) {
|
public function deleteOrder($order_id) {
|
||||||
|
|
||||||
|
// verify the required parameter 'order_id' is set
|
||||||
|
if ($order_id === null) {
|
||||||
|
throw new \Exception("Missing the required parameter $order_id when calling deleteOrder");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/store/order/{orderId}";
|
$resourcePath = "/store/order/{orderId}";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
|
@ -39,6 +39,7 @@ class UserApi {
|
|||||||
*/
|
*/
|
||||||
public function createUser($body) {
|
public function createUser($body) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/user";
|
$resourcePath = "/user";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -92,6 +93,7 @@ class UserApi {
|
|||||||
*/
|
*/
|
||||||
public function createUsersWithArrayInput($body) {
|
public function createUsersWithArrayInput($body) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/user/createWithArray";
|
$resourcePath = "/user/createWithArray";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -145,6 +147,7 @@ class UserApi {
|
|||||||
*/
|
*/
|
||||||
public function createUsersWithListInput($body) {
|
public function createUsersWithListInput($body) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/user/createWithList";
|
$resourcePath = "/user/createWithList";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -199,6 +202,7 @@ class UserApi {
|
|||||||
*/
|
*/
|
||||||
public function loginUser($username, $password) {
|
public function loginUser($username, $password) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/user/login";
|
$resourcePath = "/user/login";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -259,6 +263,7 @@ class UserApi {
|
|||||||
*/
|
*/
|
||||||
public function logoutUser() {
|
public function logoutUser() {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/user/logout";
|
$resourcePath = "/user/logout";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -308,6 +313,12 @@ class UserApi {
|
|||||||
*/
|
*/
|
||||||
public function getUserByName($username) {
|
public function getUserByName($username) {
|
||||||
|
|
||||||
|
// verify the required parameter 'username' is set
|
||||||
|
if ($username === null) {
|
||||||
|
throw new \Exception("Missing the required parameter $username when calling getUserByName");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/user/{username}";
|
$resourcePath = "/user/{username}";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -368,6 +379,12 @@ class UserApi {
|
|||||||
*/
|
*/
|
||||||
public function updateUser($username, $body) {
|
public function updateUser($username, $body) {
|
||||||
|
|
||||||
|
// verify the required parameter 'username' is set
|
||||||
|
if ($username === null) {
|
||||||
|
throw new \Exception("Missing the required parameter $username when calling updateUser");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/user/{username}";
|
$resourcePath = "/user/{username}";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
@ -425,6 +442,12 @@ class UserApi {
|
|||||||
*/
|
*/
|
||||||
public function deleteUser($username) {
|
public function deleteUser($username) {
|
||||||
|
|
||||||
|
// verify the required parameter 'username' is set
|
||||||
|
if ($username === null) {
|
||||||
|
throw new \Exception("Missing the required parameter $username when calling deleteUser");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/user/{username}";
|
$resourcePath = "/user/{username}";
|
||||||
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
$resourcePath = str_replace("{format}", "json", $resourcePath);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user