mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 22:20:56 +00:00
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}}";
|
||||||
|
@ -38,6 +38,7 @@ class PetApi {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function updatePet($body) {
|
public function updatePet($body) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/pet";
|
$resourcePath = "/pet";
|
||||||
@ -91,6 +92,7 @@ class PetApi {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function addPet($body) {
|
public function addPet($body) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/pet";
|
$resourcePath = "/pet";
|
||||||
@ -144,6 +146,7 @@ class PetApi {
|
|||||||
* @return array[Pet]
|
* @return array[Pet]
|
||||||
*/
|
*/
|
||||||
public function findPetsByStatus($status) {
|
public function findPetsByStatus($status) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/pet/findByStatus";
|
$resourcePath = "/pet/findByStatus";
|
||||||
@ -202,6 +205,7 @@ class PetApi {
|
|||||||
* @return array[Pet]
|
* @return array[Pet]
|
||||||
*/
|
*/
|
||||||
public function findPetsByTags($tags) {
|
public function findPetsByTags($tags) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/pet/findByTags";
|
$resourcePath = "/pet/findByTags";
|
||||||
@ -260,6 +264,12 @@ class PetApi {
|
|||||||
* @return Pet
|
* @return Pet
|
||||||
*/
|
*/
|
||||||
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}";
|
||||||
@ -321,6 +331,12 @@ class PetApi {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
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}";
|
||||||
@ -381,6 +397,12 @@ class PetApi {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
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}";
|
||||||
@ -439,6 +461,12 @@ class PetApi {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
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";
|
||||||
|
@ -37,6 +37,7 @@ class StoreApi {
|
|||||||
* @return map[string,int]
|
* @return map[string,int]
|
||||||
*/
|
*/
|
||||||
public function getInventory() {
|
public function getInventory() {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/store/inventory";
|
$resourcePath = "/store/inventory";
|
||||||
@ -92,6 +93,7 @@ class StoreApi {
|
|||||||
* @return Order
|
* @return Order
|
||||||
*/
|
*/
|
||||||
public function placeOrder($body) {
|
public function placeOrder($body) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/store/order";
|
$resourcePath = "/store/order";
|
||||||
@ -151,6 +153,12 @@ class StoreApi {
|
|||||||
* @return Order
|
* @return Order
|
||||||
*/
|
*/
|
||||||
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}";
|
||||||
@ -210,6 +218,12 @@ class StoreApi {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
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}";
|
||||||
|
@ -38,6 +38,7 @@ class UserApi {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function createUser($body) {
|
public function createUser($body) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/user";
|
$resourcePath = "/user";
|
||||||
@ -91,6 +92,7 @@ class UserApi {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function createUsersWithArrayInput($body) {
|
public function createUsersWithArrayInput($body) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/user/createWithArray";
|
$resourcePath = "/user/createWithArray";
|
||||||
@ -144,6 +146,7 @@ class UserApi {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function createUsersWithListInput($body) {
|
public function createUsersWithListInput($body) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/user/createWithList";
|
$resourcePath = "/user/createWithList";
|
||||||
@ -198,6 +201,7 @@ class UserApi {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function loginUser($username, $password) {
|
public function loginUser($username, $password) {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/user/login";
|
$resourcePath = "/user/login";
|
||||||
@ -258,6 +262,7 @@ class UserApi {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function logoutUser() {
|
public function logoutUser() {
|
||||||
|
|
||||||
|
|
||||||
// parse inputs
|
// parse inputs
|
||||||
$resourcePath = "/user/logout";
|
$resourcePath = "/user/logout";
|
||||||
@ -307,6 +312,12 @@ class UserApi {
|
|||||||
* @return User
|
* @return User
|
||||||
*/
|
*/
|
||||||
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}";
|
||||||
@ -367,6 +378,12 @@ class UserApi {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
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}";
|
||||||
@ -424,6 +441,12 @@ class UserApi {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
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}";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user