diff --git a/bin/perl-petstore.sh b/bin/perl-petstore.sh index b2eb1753d67..f3eb5b17bd9 100755 --- a/bin/perl-petstore.sh +++ b/bin/perl-petstore.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" # complex module name used for testing -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l perl -o samples/client/petstore/perl" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l perl -o samples/client/petstore/perl" java $JAVA_OPTS -jar $executable $ags diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 18db67296f2..a4c5c47558a 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -2,7 +2,7 @@ WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. # VERSION @@ -10,7 +10,7 @@ Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-12T12:54:53.924+08:00 +- Build date: 2016-04-13T22:41:41.133+08:00 - Build package: class io.swagger.codegen.languages.PerlClientCodegen ## A note on Moose @@ -232,11 +232,11 @@ use WWW::SwaggerClient::UserApi; To load the models: ```perl use WWW::SwaggerClient::Object::Animal; +use WWW::SwaggerClient::Object::ApiResponse; use WWW::SwaggerClient::Object::Cat; use WWW::SwaggerClient::Object::Category; use WWW::SwaggerClient::Object::Dog; use WWW::SwaggerClient::Object::FormatTest; -use WWW::SwaggerClient::Object::InlineResponse200; use WWW::SwaggerClient::Object::Model200Response; use WWW::SwaggerClient::Object::ModelReturn; use WWW::SwaggerClient::Object::Name; @@ -262,11 +262,11 @@ use WWW::SwaggerClient::UserApi; # load the models use WWW::SwaggerClient::Object::Animal; +use WWW::SwaggerClient::Object::ApiResponse; use WWW::SwaggerClient::Object::Cat; use WWW::SwaggerClient::Object::Category; use WWW::SwaggerClient::Object::Dog; use WWW::SwaggerClient::Object::FormatTest; -use WWW::SwaggerClient::Object::InlineResponse200; use WWW::SwaggerClient::Object::Model200Response; use WWW::SwaggerClient::Object::ModelReturn; use WWW::SwaggerClient::Object::Name; @@ -301,20 +301,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store -*PetApi* | [**add_pet_using_byte_array**](docs/PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store *PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID -*PetApi* | [**get_pet_by_id_in_object**](docs/PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -*PetApi* | [**pet_pet_idtesting_byte_arraytrue_get**](docs/PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image *StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*StoreApi* | [**find_orders_by_status**](docs/StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status -*StoreApi* | [**get_inventory_in_object**](docs/StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet *UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user @@ -329,11 +324,11 @@ Class | Method | HTTP request | Description # DOCUMENTATION FOR MODELS - [WWW::SwaggerClient::Object::Animal](docs/Animal.md) + - [WWW::SwaggerClient::Object::ApiResponse](docs/ApiResponse.md) - [WWW::SwaggerClient::Object::Cat](docs/Cat.md) - [WWW::SwaggerClient::Object::Category](docs/Category.md) - [WWW::SwaggerClient::Object::Dog](docs/Dog.md) - [WWW::SwaggerClient::Object::FormatTest](docs/FormatTest.md) - - [WWW::SwaggerClient::Object::InlineResponse200](docs/InlineResponse200.md) - [WWW::SwaggerClient::Object::Model200Response](docs/Model200Response.md) - [WWW::SwaggerClient::Object::ModelReturn](docs/ModelReturn.md) - [WWW::SwaggerClient::Object::Name](docs/Name.md) @@ -346,40 +341,12 @@ Class | Method | HTTP request | Description # DOCUMENTATION FOR AUTHORIATION -## test_api_key_header - -- **Type**: API key -- **API key parameter name**: test_api_key_header -- **Location**: HTTP header - ## api_key - **Type**: API key - **API key parameter name**: api_key - **Location**: HTTP header -## test_http_basic - -- **Type**: HTTP basic authentication - -## test_api_client_secret - -- **Type**: API key -- **API key parameter name**: x-test_api_client_secret -- **Location**: HTTP header - -## test_api_client_id - -- **Type**: API key -- **API key parameter name**: x-test_api_client_id -- **Location**: HTTP header - -## test_api_key_query - -- **Type**: API key -- **API key parameter name**: test_api_key_query -- **Location**: URL query string - ## petstore_auth - **Type**: OAuth diff --git a/samples/client/petstore/perl/docs/Order.md b/samples/client/petstore/perl/docs/Order.md index 542a3a91240..cffb6a6af23 100644 --- a/samples/client/petstore/perl/docs/Order.md +++ b/samples/client/petstore/perl/docs/Order.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes **quantity** | **int** | | [optional] **ship_date** | **DateTime** | | [optional] **status** | **string** | Order Status | [optional] -**complete** | **boolean** | | [optional] +**complete** | **boolean** | | [optional] [default to false] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/docs/PetApi.md b/samples/client/petstore/perl/docs/PetApi.md index 554e0a68fe6..b415e127d31 100644 --- a/samples/client/petstore/perl/docs/PetApi.md +++ b/samples/client/petstore/perl/docs/PetApi.md @@ -10,13 +10,10 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store -[**add_pet_using_byte_array**](PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store [**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID -[**get_pet_by_id_in_object**](PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -[**pet_pet_idtesting_byte_arraytrue_get**](PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -51,7 +48,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -64,53 +61,7 @@ void (empty response body) ### HTTP reuqest headers - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **add_pet_using_byte_array** -> add_pet_using_byte_array(body => $body) - -Fake endpoint to test byte array in body parameter for adding a new pet to the store - - - -### Example -```perl -use Data::Dumper; - -# Configure OAuth2 access token for authorization: petstore_auth -$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; - -my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $body = WWW::SwaggerClient::Object::string->new(); # string | Pet object in the form of byte array - -eval { - $api_instance->add_pet_using_byte_array(body => $body); -}; -if ($@) { - warn "Exception when calling PetApi->add_pet_using_byte_array: $@\n"; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **string**| Pet object in the form of byte array | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP reuqest headers - - - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -158,7 +109,7 @@ void (empty response body) ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -177,7 +128,7 @@ use Data::Dumper; $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $status = (); # ARRAY[string] | Status values that need to be considered for query +my $status = (); # ARRAY[string] | Status values that need to be considered for filter eval { my $result = $api_instance->find_pets_by_status(status => $status); @@ -192,7 +143,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**ARRAY[string]**](string.md)| Status values that need to be considered for query | [optional] [default to available] + **status** | [**ARRAY[string]**](string.md)| Status values that need to be considered for filter | ### Return type @@ -205,7 +156,7 @@ Name | Type | Description | Notes ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -214,7 +165,7 @@ Name | Type | Description | Notes Finds Pets by tags -Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. ### Example ```perl @@ -239,7 +190,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**ARRAY[string]**](string.md)| Tags to filter by | [optional] + **tags** | [**ARRAY[string]**](string.md)| Tags to filter by | ### Return type @@ -252,7 +203,7 @@ Name | Type | Description | Notes ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -261,7 +212,7 @@ Name | Type | Description | Notes Find pet by ID -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions +Returns a single pet ### Example ```perl @@ -271,11 +222,9 @@ use Data::Dumper; $WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; # uncomment below to setup prefix (e.g. BEARER) for API key, if needed #$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER"; -# Configure OAuth2 access token for authorization: petstore_auth -$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $pet_id = 789; # int | ID of pet that needs to be fetched +my $pet_id = 789; # int | ID of pet to return eval { my $result = $api_instance->get_pet_by_id(pet_id => $pet_id); @@ -290,7 +239,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet that needs to be fetched | + **pet_id** | **int**| ID of pet to return | ### Return type @@ -298,114 +247,12 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) +[api_key](../README.md#api_key) ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_pet_by_id_in_object** -> InlineResponse200 get_pet_by_id_in_object(pet_id => $pet_id) - -Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - -### Example -```perl -use Data::Dumper; - -# Configure API key authorization: api_key -$WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER"; -# Configure OAuth2 access token for authorization: petstore_auth -$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; - -my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $pet_id = 789; # int | ID of pet that needs to be fetched - -eval { - my $result = $api_instance->get_pet_by_id_in_object(pet_id => $pet_id); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling PetApi->get_pet_by_id_in_object: $@\n"; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet that needs to be fetched | - -### Return type - -[**InlineResponse200**](InlineResponse200.md) - -### Authorization - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - -### HTTP reuqest headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **pet_pet_idtesting_byte_arraytrue_get** -> string pet_pet_idtesting_byte_arraytrue_get(pet_id => $pet_id) - -Fake endpoint to test byte array return by 'Find pet by ID' - -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - -### Example -```perl -use Data::Dumper; - -# Configure API key authorization: api_key -$WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER"; -# Configure OAuth2 access token for authorization: petstore_auth -$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; - -my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $pet_id = 789; # int | ID of pet that needs to be fetched - -eval { - my $result = $api_instance->pet_pet_idtesting_byte_arraytrue_get(pet_id => $pet_id); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling PetApi->pet_pet_idtesting_byte_arraytrue_get: $@\n"; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet that needs to be fetched | - -### Return type - -**string** - -### Authorization - -[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) - -### HTTP reuqest headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -438,7 +285,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -451,7 +298,7 @@ void (empty response body) ### HTTP reuqest headers - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -470,7 +317,7 @@ use Data::Dumper; $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $pet_id = 'pet_id_example'; # string | ID of pet that needs to be updated +my $pet_id = 789; # int | ID of pet that needs to be updated my $name = 'name_example'; # string | Updated name of the pet my $status = 'status_example'; # string | Updated status of the pet @@ -486,7 +333,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **string**| ID of pet that needs to be updated | + **pet_id** | **int**| ID of pet that needs to be updated | **name** | **string**| Updated name of the pet | [optional] **status** | **string**| Updated status of the pet | [optional] @@ -501,12 +348,12 @@ void (empty response body) ### HTTP reuqest headers - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **upload_file** -> upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file) +> ApiResponse upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file) uploads an image @@ -525,7 +372,8 @@ my $additional_metadata = 'additional_metadata_example'; # string | Additional d my $file = '/path/to/file.txt'; # File | file to upload eval { - $api_instance->upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file); + my $result = $api_instance->upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file); + print Dumper($result); }; if ($@) { warn "Exception when calling PetApi->upload_file: $@\n"; @@ -542,7 +390,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +[**ApiResponse**](ApiResponse.md) ### Authorization @@ -551,7 +399,7 @@ void (empty response body) ### HTTP reuqest headers - **Content-Type**: multipart/form-data - - **Accept**: application/json, application/xml + - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/docs/StoreApi.md b/samples/client/petstore/perl/docs/StoreApi.md index 175995b6934..e6c80ad44e3 100644 --- a/samples/client/petstore/perl/docs/StoreApi.md +++ b/samples/client/petstore/perl/docs/StoreApi.md @@ -10,9 +10,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -[**find_orders_by_status**](StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status [**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status -[**get_inventory_in_object**](StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' [**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID [**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet @@ -56,60 +54,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **find_orders_by_status** -> ARRAY[Order] find_orders_by_status(status => $status) - -Finds orders by status - -A single status value can be provided as a string - -### Example -```perl -use Data::Dumper; - -# Configure API key authorization: test_api_client_id -$WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_id'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_id'} = "BEARER"; -# Configure API key authorization: test_api_client_secret -$WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "BEARER"; - -my $api_instance = WWW::SwaggerClient::StoreApi->new(); -my $status = 'status_example'; # string | Status value that needs to be considered for query - -eval { - my $result = $api_instance->find_orders_by_status(status => $status); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling StoreApi->find_orders_by_status: $@\n"; -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | **string**| Status value that needs to be considered for query | [optional] [default to placed] - -### Return type - -[**ARRAY[Order]**](Order.md) - -### Authorization - -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) - -### HTTP reuqest headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -154,52 +99,7 @@ This endpoint does not need any parameter. ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - -# **get_inventory_in_object** -> object get_inventory_in_object() - -Fake endpoint to test arbitrary object return by 'Get inventory' - -Returns an arbitrary object which is actually a map of status codes to quantities - -### Example -```perl -use Data::Dumper; - -# Configure API key authorization: api_key -$WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER"; - -my $api_instance = WWW::SwaggerClient::StoreApi->new(); - -eval { - my $result = $api_instance->get_inventory_in_object(); - print Dumper($result); -}; -if ($@) { - warn "Exception when calling StoreApi->get_inventory_in_object: $@\n"; -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**object** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP reuqest headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -214,17 +114,8 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ```perl use Data::Dumper; -# Configure API key authorization: test_api_key_header -$WWW::SwaggerClient::Configuration::api_key->{'test_api_key_header'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'test_api_key_header'} = "BEARER"; -# Configure API key authorization: test_api_key_query -$WWW::SwaggerClient::Configuration::api_key->{'test_api_key_query'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'test_api_key_query'} = "BEARER"; - my $api_instance = WWW::SwaggerClient::StoreApi->new(); -my $order_id = 'order_id_example'; # string | ID of pet that needs to be fetched +my $order_id = 789; # int | ID of pet that needs to be fetched eval { my $result = $api_instance->get_order_by_id(order_id => $order_id); @@ -239,7 +130,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **string**| ID of pet that needs to be fetched | + **order_id** | **int**| ID of pet that needs to be fetched | ### Return type @@ -247,12 +138,12 @@ Name | Type | Description | Notes ### Authorization -[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) +No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -267,15 +158,6 @@ Place an order for a pet ```perl use Data::Dumper; -# Configure API key authorization: test_api_client_id -$WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_id'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_id'} = "BEARER"; -# Configure API key authorization: test_api_client_secret -$WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR_API_KEY'; -# uncomment below to setup prefix (e.g. BEARER) for API key, if needed -#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "BEARER"; - my $api_instance = WWW::SwaggerClient::StoreApi->new(); my $body = WWW::SwaggerClient::Object::Order->new(); # Order | order placed for purchasing the pet @@ -292,7 +174,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional] + **body** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type @@ -300,12 +182,12 @@ Name | Type | Description | Notes ### Authorization -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) +No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/docs/UserApi.md b/samples/client/petstore/perl/docs/UserApi.md index a7318866fe6..8b4a07efa49 100644 --- a/samples/client/petstore/perl/docs/UserApi.md +++ b/samples/client/petstore/perl/docs/UserApi.md @@ -45,7 +45,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | [optional] + **body** | [**User**](User.md)| Created user object | ### Return type @@ -58,7 +58,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -88,7 +88,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**ARRAY[User]**](User.md)| List of user object | [optional] + **body** | [**ARRAY[User]**](User.md)| List of user object | ### Return type @@ -101,7 +101,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -131,7 +131,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**ARRAY[User]**](User.md)| List of user object | [optional] + **body** | [**ARRAY[User]**](User.md)| List of user object | ### Return type @@ -144,7 +144,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -159,10 +159,6 @@ This can only be done by the logged in user. ```perl use Data::Dumper; -# Configure HTTP basic authorization: test_http_basic -$WWW::SwaggerClient::Configuration::username = 'YOUR_USERNAME'; -$WWW::SwaggerClient::Configuration::password = 'YOUR_PASSWORD'; - my $api_instance = WWW::SwaggerClient::UserApi->new(); my $username = 'username_example'; # string | The name that needs to be deleted @@ -186,12 +182,12 @@ void (empty response body) ### Authorization -[test_http_basic](../README.md#test_http_basic) +No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -235,7 +231,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -267,8 +263,8 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **string**| The user name for login | [optional] - **password** | **string**| The password for login in clear text | [optional] + **username** | **string**| The user name for login | + **password** | **string**| The password for login in clear text | ### Return type @@ -281,7 +277,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -320,7 +316,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -352,7 +348,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **string**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | [optional] + **body** | [**User**](User.md)| Updated user object | ### Return type @@ -365,7 +361,7 @@ No authorization required ### HTTP reuqest headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm index b5fd24c2b1b..3dfa6633ee5 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm @@ -319,47 +319,13 @@ sub update_params_for_auth { if (!defined($auth)) { # TODO show warning about auth setting not defined } - elsif ($auth eq 'test_api_key_header') { - - my $api_key = $self->get_api_key_with_prefix('test_api_key_header'); - if ($api_key) { - $header_params->{'test_api_key_header'} = $api_key; - } - } -elsif ($auth eq 'api_key') { + elsif ($auth eq 'api_key') { my $api_key = $self->get_api_key_with_prefix('api_key'); if ($api_key) { $header_params->{'api_key'} = $api_key; } } -elsif ($auth eq 'test_http_basic') { - - if ($WWW::SwaggerClient::Configuration::username || $WWW::SwaggerClient::Configuration::password) { - $header_params->{'Authorization'} = 'Basic ' . encode_base64($WWW::SwaggerClient::Configuration::username . ":" . $WWW::SwaggerClient::Configuration::password); - } - } -elsif ($auth eq 'test_api_client_secret') { - - my $api_key = $self->get_api_key_with_prefix('x-test_api_client_secret'); - if ($api_key) { - $header_params->{'x-test_api_client_secret'} = $api_key; - } - } -elsif ($auth eq 'test_api_client_id') { - - my $api_key = $self->get_api_key_with_prefix('x-test_api_client_id'); - if ($api_key) { - $header_params->{'x-test_api_client_id'} = $api_key; - } - } -elsif ($auth eq 'test_api_key_query') { - - my $api_key = $self->get_api_key_with_prefix('test_api_key_query'); - if ($api_key) { - $query_params->{'test_api_key_query'} = $api_key; - } - } elsif ($auth eq 'petstore_auth') { if ($WWW::SwaggerClient::Configuration::access_token) { diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm index 53222949718..fd1b4092302 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm @@ -56,13 +56,13 @@ sub new { # # Add a new pet to the store # -# @param Pet $body Pet object that needs to be added to the store (optional) +# @param Pet $body Pet object that needs to be added to the store (required) { my $params = { 'body' => { data_type => 'Pet', description => 'Pet object that needs to be added to the store', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ add_pet } = { @@ -76,6 +76,11 @@ sub new { sub add_pet { my ($self, %args) = @_; + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling add_pet"); + } + # parse inputs my $_resource_path = '/pet'; $_resource_path =~ s/{format}/json/; # default format to json @@ -86,64 +91,7 @@ sub add_pet { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); - if ($_header_accept) { - $header_params->{'Accept'} = $_header_accept; - } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', 'application/xml'); - - my $_body_data; - # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; - } - - # authentication setting, if any - my $auth_settings = [qw(petstore_auth )]; - - # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - return; -} - -# -# add_pet_using_byte_array -# -# Fake endpoint to test byte array in body parameter for adding a new pet to the store -# -# @param string $body Pet object in the form of byte array (optional) -{ - my $params = { - 'body' => { - data_type => 'string', - description => 'Pet object in the form of byte array', - required => '0', - }, - }; - __PACKAGE__->method_documentation->{ add_pet_using_byte_array } = { - summary => 'Fake endpoint to test byte array in body parameter for adding a new pet to the store', - params => $params, - returns => undef, - }; -} -# @return void -# -sub add_pet_using_byte_array { - my ($self, %args) = @_; - - # parse inputs - my $_resource_path = '/pet?testing_byte_array=true'; - $_resource_path =~ s/{format}/json/; # default format to json - - my $_method = 'POST'; - my $query_params = {}; - my $header_params = {}; - my $form_params = {}; - - # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -211,7 +159,7 @@ sub delete_pet { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -245,13 +193,13 @@ sub delete_pet { # # Finds Pets by status # -# @param ARRAY[string] $status Status values that need to be considered for query (optional, default to available) +# @param ARRAY[string] $status Status values that need to be considered for filter (required) { my $params = { 'status' => { data_type => 'ARRAY[string]', - description => 'Status values that need to be considered for query', - required => '0', + description => 'Status values that need to be considered for filter', + required => '1', }, }; __PACKAGE__->method_documentation->{ find_pets_by_status } = { @@ -265,6 +213,11 @@ sub delete_pet { sub find_pets_by_status { my ($self, %args) = @_; + # verify the required parameter 'status' is set + unless (exists $args{'status'}) { + croak("Missing the required parameter 'status' when calling find_pets_by_status"); + } + # parse inputs my $_resource_path = '/pet/findByStatus'; $_resource_path =~ s/{format}/json/; # default format to json @@ -275,7 +228,7 @@ sub find_pets_by_status { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -306,13 +259,13 @@ sub find_pets_by_status { # # Finds Pets by tags # -# @param ARRAY[string] $tags Tags to filter by (optional) +# @param ARRAY[string] $tags Tags to filter by (required) { my $params = { 'tags' => { data_type => 'ARRAY[string]', description => 'Tags to filter by', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ find_pets_by_tags } = { @@ -326,6 +279,11 @@ sub find_pets_by_status { sub find_pets_by_tags { my ($self, %args) = @_; + # verify the required parameter 'tags' is set + unless (exists $args{'tags'}) { + croak("Missing the required parameter 'tags' when calling find_pets_by_tags"); + } + # parse inputs my $_resource_path = '/pet/findByTags'; $_resource_path =~ s/{format}/json/; # default format to json @@ -336,7 +294,7 @@ sub find_pets_by_tags { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -367,12 +325,12 @@ sub find_pets_by_tags { # # Find pet by ID # -# @param int $pet_id ID of pet that needs to be fetched (required) +# @param int $pet_id ID of pet to return (required) { my $params = { 'pet_id' => { data_type => 'int', - description => 'ID of pet that needs to be fetched', + description => 'ID of pet to return', required => '1', }, }; @@ -402,7 +360,7 @@ sub get_pet_by_id { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -417,7 +375,7 @@ sub get_pet_by_id { my $_body_data; # authentication setting, if any - my $auth_settings = [qw(api_key petstore_auth )]; + my $auth_settings = [qw(api_key )]; # make the API Call my $response = $self->{api_client}->call_api($_resource_path, $_method, @@ -430,154 +388,18 @@ sub get_pet_by_id { return $_response_object; } -# -# get_pet_by_id_in_object -# -# Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -# -# @param int $pet_id ID of pet that needs to be fetched (required) -{ - my $params = { - 'pet_id' => { - data_type => 'int', - description => 'ID of pet that needs to be fetched', - required => '1', - }, - }; - __PACKAGE__->method_documentation->{ get_pet_by_id_in_object } = { - summary => 'Fake endpoint to test inline arbitrary object return by 'Find pet by ID'', - params => $params, - returns => 'InlineResponse200', - }; -} -# @return InlineResponse200 -# -sub get_pet_by_id_in_object { - my ($self, %args) = @_; - - # verify the required parameter 'pet_id' is set - unless (exists $args{'pet_id'}) { - croak("Missing the required parameter 'pet_id' when calling get_pet_by_id_in_object"); - } - - # parse inputs - my $_resource_path = '/pet/{petId}?response=inline_arbitrary_object'; - $_resource_path =~ s/{format}/json/; # default format to json - - my $_method = 'GET'; - my $query_params = {}; - my $header_params = {}; - my $form_params = {}; - - # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); - if ($_header_accept) { - $header_params->{'Accept'} = $_header_accept; - } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); - - # path params - if ( exists $args{'pet_id'}) { - my $_base_variable = "{" . "petId" . "}"; - my $_base_value = $self->{api_client}->to_path_value($args{'pet_id'}); - $_resource_path =~ s/$_base_variable/$_base_value/g; - } - - my $_body_data; - # authentication setting, if any - my $auth_settings = [qw(api_key petstore_auth )]; - - # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { - return; - } - my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response); - return $_response_object; -} - -# -# pet_pet_idtesting_byte_arraytrue_get -# -# Fake endpoint to test byte array return by 'Find pet by ID' -# -# @param int $pet_id ID of pet that needs to be fetched (required) -{ - my $params = { - 'pet_id' => { - data_type => 'int', - description => 'ID of pet that needs to be fetched', - required => '1', - }, - }; - __PACKAGE__->method_documentation->{ pet_pet_idtesting_byte_arraytrue_get } = { - summary => 'Fake endpoint to test byte array return by 'Find pet by ID'', - params => $params, - returns => 'string', - }; -} -# @return string -# -sub pet_pet_idtesting_byte_arraytrue_get { - my ($self, %args) = @_; - - # verify the required parameter 'pet_id' is set - unless (exists $args{'pet_id'}) { - croak("Missing the required parameter 'pet_id' when calling pet_pet_idtesting_byte_arraytrue_get"); - } - - # parse inputs - my $_resource_path = '/pet/{petId}?testing_byte_array=true'; - $_resource_path =~ s/{format}/json/; # default format to json - - my $_method = 'GET'; - my $query_params = {}; - my $header_params = {}; - my $form_params = {}; - - # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); - if ($_header_accept) { - $header_params->{'Accept'} = $_header_accept; - } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); - - # path params - if ( exists $args{'pet_id'}) { - my $_base_variable = "{" . "petId" . "}"; - my $_base_value = $self->{api_client}->to_path_value($args{'pet_id'}); - $_resource_path =~ s/$_base_variable/$_base_value/g; - } - - my $_body_data; - # authentication setting, if any - my $auth_settings = [qw(api_key petstore_auth )]; - - # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { - return; - } - my $_response_object = $self->{api_client}->deserialize('string', $response); - return $_response_object; -} - # # update_pet # # Update an existing pet # -# @param Pet $body Pet object that needs to be added to the store (optional) +# @param Pet $body Pet object that needs to be added to the store (required) { my $params = { 'body' => { data_type => 'Pet', description => 'Pet object that needs to be added to the store', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ update_pet } = { @@ -591,6 +413,11 @@ sub pet_pet_idtesting_byte_arraytrue_get { sub update_pet { my ($self, %args) = @_; + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling update_pet"); + } + # parse inputs my $_resource_path = '/pet'; $_resource_path =~ s/{format}/json/; # default format to json @@ -601,7 +428,7 @@ sub update_pet { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -628,13 +455,13 @@ sub update_pet { # # Updates a pet in the store with form data # -# @param string $pet_id ID of pet that needs to be updated (required) +# @param int $pet_id ID of pet that needs to be updated (required) # @param string $name Updated name of the pet (optional) # @param string $status Updated status of the pet (optional) { my $params = { 'pet_id' => { - data_type => 'string', + data_type => 'int', description => 'ID of pet that needs to be updated', required => '1', }, @@ -675,7 +502,7 @@ sub update_pet_with_form { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -738,10 +565,10 @@ sub update_pet_with_form { __PACKAGE__->method_documentation->{ upload_file } = { summary => 'uploads an image', params => $params, - returns => undef, + returns => 'ApiResponse', }; } -# @return void +# @return ApiResponse # sub upload_file { my ($self, %args) = @_; @@ -761,7 +588,7 @@ sub upload_file { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -790,10 +617,14 @@ sub upload_file { my $auth_settings = [qw(petstore_auth )]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, + my $response = $self->{api_client}->call_api($_resource_path, $_method, $query_params, $form_params, $header_params, $_body_data, $auth_settings); - return; + if (!$response) { + return; + } + my $_response_object = $self->{api_client}->deserialize('ApiResponse', $response); + return $_response_object; } 1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm index 77b2c79e112..e72b12a22b8 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm @@ -37,7 +37,7 @@ has version_info => ( is => 'ro', default => sub { { app_name => 'Swagger Petstore', app_version => '1.0.0', - generated_date => '2016-04-12T12:54:53.924+08:00', + generated_date => '2016-04-13T22:41:41.133+08:00', generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen', } }, documentation => 'Information about the application version and the codegen codebase version' @@ -103,7 +103,7 @@ Automatically generated by the Perl Swagger Codegen project: =over 4 -=item Build date: 2016-04-12T12:54:53.924+08:00 +=item Build date: 2016-04-13T22:41:41.133+08:00 =item Build package: class io.swagger.codegen.languages.PerlClientCodegen diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm index 69b31f5e4ad..16a4f13cb1e 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm @@ -91,7 +91,7 @@ sub delete_order { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -115,67 +115,6 @@ sub delete_order { return; } -# -# find_orders_by_status -# -# Finds orders by status -# -# @param string $status Status value that needs to be considered for query (optional, default to placed) -{ - my $params = { - 'status' => { - data_type => 'string', - description => 'Status value that needs to be considered for query', - required => '0', - }, - }; - __PACKAGE__->method_documentation->{ find_orders_by_status } = { - summary => 'Finds orders by status', - params => $params, - returns => 'ARRAY[Order]', - }; -} -# @return ARRAY[Order] -# -sub find_orders_by_status { - my ($self, %args) = @_; - - # parse inputs - my $_resource_path = '/store/findByStatus'; - $_resource_path =~ s/{format}/json/; # default format to json - - my $_method = 'GET'; - my $query_params = {}; - my $header_params = {}; - my $form_params = {}; - - # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); - if ($_header_accept) { - $header_params->{'Accept'} = $_header_accept; - } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); - - # query params - if ( exists $args{'status'}) { - $query_params->{'status'} = $self->{api_client}->to_query_value($args{'status'}); - } - - my $_body_data; - # authentication setting, if any - my $auth_settings = [qw(test_api_client_id test_api_client_secret )]; - - # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { - return; - } - my $_response_object = $self->{api_client}->deserialize('ARRAY[Order]', $response); - return $_response_object; -} - # # get_inventory # @@ -205,7 +144,7 @@ sub get_inventory { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -226,66 +165,16 @@ sub get_inventory { return $_response_object; } -# -# get_inventory_in_object -# -# Fake endpoint to test arbitrary object return by 'Get inventory' -# -{ - my $params = { - }; - __PACKAGE__->method_documentation->{ get_inventory_in_object } = { - summary => 'Fake endpoint to test arbitrary object return by 'Get inventory'', - params => $params, - returns => 'object', - }; -} -# @return object -# -sub get_inventory_in_object { - my ($self, %args) = @_; - - # parse inputs - my $_resource_path = '/store/inventory?response=arbitrary_object'; - $_resource_path =~ s/{format}/json/; # default format to json - - my $_method = 'GET'; - my $query_params = {}; - my $header_params = {}; - my $form_params = {}; - - # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); - if ($_header_accept) { - $header_params->{'Accept'} = $_header_accept; - } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); - - my $_body_data; - # authentication setting, if any - my $auth_settings = [qw(api_key )]; - - # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { - return; - } - my $_response_object = $self->{api_client}->deserialize('object', $response); - return $_response_object; -} - # # get_order_by_id # # Find purchase order by ID # -# @param string $order_id ID of pet that needs to be fetched (required) +# @param int $order_id ID of pet that needs to be fetched (required) { my $params = { 'order_id' => { - data_type => 'string', + data_type => 'int', description => 'ID of pet that needs to be fetched', required => '1', }, @@ -316,7 +205,7 @@ sub get_order_by_id { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -331,7 +220,7 @@ sub get_order_by_id { my $_body_data; # authentication setting, if any - my $auth_settings = [qw(test_api_key_header test_api_key_query )]; + my $auth_settings = [qw()]; # make the API Call my $response = $self->{api_client}->call_api($_resource_path, $_method, @@ -349,13 +238,13 @@ sub get_order_by_id { # # Place an order for a pet # -# @param Order $body order placed for purchasing the pet (optional) +# @param Order $body order placed for purchasing the pet (required) { my $params = { 'body' => { data_type => 'Order', description => 'order placed for purchasing the pet', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ place_order } = { @@ -369,6 +258,11 @@ sub get_order_by_id { sub place_order { my ($self, %args) = @_; + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling place_order"); + } + # parse inputs my $_resource_path = '/store/order'; $_resource_path =~ s/{format}/json/; # default format to json @@ -379,7 +273,7 @@ sub place_order { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -392,7 +286,7 @@ sub place_order { } # authentication setting, if any - my $auth_settings = [qw(test_api_client_id test_api_client_secret )]; + my $auth_settings = [qw()]; # make the API Call my $response = $self->{api_client}->call_api($_resource_path, $_method, diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm index 20e2a1644dc..75f56f56293 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm @@ -56,13 +56,13 @@ sub new { # # Create user # -# @param User $body Created user object (optional) +# @param User $body Created user object (required) { my $params = { 'body' => { data_type => 'User', description => 'Created user object', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ create_user } = { @@ -76,6 +76,11 @@ sub new { sub create_user { my ($self, %args) = @_; + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling create_user"); + } + # parse inputs my $_resource_path = '/user'; $_resource_path =~ s/{format}/json/; # default format to json @@ -86,7 +91,7 @@ sub create_user { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -113,13 +118,13 @@ sub create_user { # # Creates list of users with given input array # -# @param ARRAY[User] $body List of user object (optional) +# @param ARRAY[User] $body List of user object (required) { my $params = { 'body' => { data_type => 'ARRAY[User]', description => 'List of user object', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ create_users_with_array_input } = { @@ -133,6 +138,11 @@ sub create_user { sub create_users_with_array_input { my ($self, %args) = @_; + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling create_users_with_array_input"); + } + # parse inputs my $_resource_path = '/user/createWithArray'; $_resource_path =~ s/{format}/json/; # default format to json @@ -143,7 +153,7 @@ sub create_users_with_array_input { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -170,13 +180,13 @@ sub create_users_with_array_input { # # Creates list of users with given input array # -# @param ARRAY[User] $body List of user object (optional) +# @param ARRAY[User] $body List of user object (required) { my $params = { 'body' => { data_type => 'ARRAY[User]', description => 'List of user object', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ create_users_with_list_input } = { @@ -190,6 +200,11 @@ sub create_users_with_array_input { sub create_users_with_list_input { my ($self, %args) = @_; + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling create_users_with_list_input"); + } + # parse inputs my $_resource_path = '/user/createWithList'; $_resource_path =~ s/{format}/json/; # default format to json @@ -200,7 +215,7 @@ sub create_users_with_list_input { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -262,7 +277,7 @@ sub delete_user { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -277,7 +292,7 @@ sub delete_user { my $_body_data; # authentication setting, if any - my $auth_settings = [qw(test_http_basic )]; + my $auth_settings = [qw()]; # make the API Call $self->{api_client}->call_api($_resource_path, $_method, @@ -326,7 +341,7 @@ sub get_user_by_name { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -359,19 +374,19 @@ sub get_user_by_name { # # Logs user into the system # -# @param string $username The user name for login (optional) -# @param string $password The password for login in clear text (optional) +# @param string $username The user name for login (required) +# @param string $password The password for login in clear text (required) { my $params = { 'username' => { data_type => 'string', description => 'The user name for login', - required => '0', + required => '1', }, 'password' => { data_type => 'string', description => 'The password for login in clear text', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ login_user } = { @@ -385,6 +400,16 @@ sub get_user_by_name { sub login_user { my ($self, %args) = @_; + # verify the required parameter 'username' is set + unless (exists $args{'username'}) { + croak("Missing the required parameter 'username' when calling login_user"); + } + + # verify the required parameter 'password' is set + unless (exists $args{'password'}) { + croak("Missing the required parameter 'password' when calling login_user"); + } + # parse inputs my $_resource_path = '/user/login'; $_resource_path =~ s/{format}/json/; # default format to json @@ -395,7 +420,7 @@ sub login_user { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -455,7 +480,7 @@ sub logout_user { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -478,7 +503,7 @@ sub logout_user { # Updated user # # @param string $username name that need to be deleted (required) -# @param User $body Updated user object (optional) +# @param User $body Updated user object (required) { my $params = { 'username' => { @@ -489,7 +514,7 @@ sub logout_user { 'body' => { data_type => 'User', description => 'Updated user object', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ update_user } = { @@ -508,6 +533,11 @@ sub update_user { croak("Missing the required parameter 'username' when calling update_user"); } + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling update_user"); + } + # parse inputs my $_resource_path = '/user/{username}'; $_resource_path =~ s/{format}/json/; # default format to json @@ -518,7 +548,7 @@ sub update_user { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } diff --git a/samples/client/petstore/perl/t/PetApiTest.t b/samples/client/petstore/perl/t/PetApiTest.t index 91f87e56f24..8d0a0c84a9c 100644 --- a/samples/client/petstore/perl/t/PetApiTest.t +++ b/samples/client/petstore/perl/t/PetApiTest.t @@ -37,14 +37,6 @@ isa_ok($api, 'WWW::SwaggerClient::PetApi'); my $result = $api->add_pet(body => $body); } -# -# add_pet_using_byte_array test -# -{ - my $body = undef; # replace NULL with a proper value - my $result = $api->add_pet_using_byte_array(body => $body); -} - # # delete_pet test # @@ -78,22 +70,6 @@ isa_ok($api, 'WWW::SwaggerClient::PetApi'); my $result = $api->get_pet_by_id(pet_id => $pet_id); } -# -# get_pet_by_id_in_object test -# -{ - my $pet_id = undef; # replace NULL with a proper value - my $result = $api->get_pet_by_id_in_object(pet_id => $pet_id); -} - -# -# pet_pet_idtesting_byte_arraytrue_get test -# -{ - my $pet_id = undef; # replace NULL with a proper value - my $result = $api->pet_pet_idtesting_byte_arraytrue_get(pet_id => $pet_id); -} - # # update_pet test # diff --git a/samples/client/petstore/perl/t/StoreApiTest.t b/samples/client/petstore/perl/t/StoreApiTest.t index a9bc3b3a4f3..3bb0ed753d3 100644 --- a/samples/client/petstore/perl/t/StoreApiTest.t +++ b/samples/client/petstore/perl/t/StoreApiTest.t @@ -37,14 +37,6 @@ isa_ok($api, 'WWW::SwaggerClient::StoreApi'); my $result = $api->delete_order(order_id => $order_id); } -# -# find_orders_by_status test -# -{ - my $status = undef; # replace NULL with a proper value - my $result = $api->find_orders_by_status(status => $status); -} - # # get_inventory test # @@ -52,13 +44,6 @@ isa_ok($api, 'WWW::SwaggerClient::StoreApi'); my $result = $api->get_inventory(); } -# -# get_inventory_in_object test -# -{ - my $result = $api->get_inventory_in_object(); -} - # # get_order_by_id test # diff --git a/samples/client/petstore/perl/tests/01_pet_api.t b/samples/client/petstore/perl/tests/01_pet_api.t index c7bcdf98a0a..e63a645e38a 100644 --- a/samples/client/petstore/perl/tests/01_pet_api.t +++ b/samples/client/petstore/perl/tests/01_pet_api.t @@ -76,7 +76,7 @@ my $get_pet_after_update = $api->get_pet_by_id(pet_id => $pet_id); is $get_pet_after_update->{status}, 'sold', 'get the updated status after update_pet_with_form'; my $upload_pet = $api->upload_file(pet_id => $pet_id, additional_metadata => 'testabc', file => 'test.pl'); -is $upload_pet, undef, 'get the null response from upload_pet'; +isa_ok($upload_pet, 'WWW::SwaggerClient::Object::ApiResponse'); my $delete_pet = $api->delete_pet(pet_id => $pet_id); is $delete_pet, undef, 'get the null response from delete_pet'; diff --git a/samples/client/petstore/perl/tests/04_role.t b/samples/client/petstore/perl/tests/04_role.t index 8836c35546c..7570dfa703a 100644 --- a/samples/client/petstore/perl/tests/04_role.t +++ b/samples/client/petstore/perl/tests/04_role.t @@ -50,10 +50,10 @@ is $get_pet->tags->[0]->id, '11', 'stored and retrieved: got the proper tag id'; # API method docs is_deeply( [sort keys %{$api->pet_api->method_documentation}], - [ 'add_pet', 'add_pet_using_byte_array', 'delete_pet', 'find_pets_by_status', 'find_pets_by_tags', 'get_pet_by_id', 'get_pet_by_id_in_object', 'pet_pet_idtesting_byte_arraytrue_get', 'update_pet', 'update_pet_with_form', 'upload_file'], + [ 'add_pet', 'delete_pet', 'find_pets_by_status', 'find_pets_by_tags', 'get_pet_by_id', 'update_pet', 'update_pet_with_form', 'upload_file'], "Pet API method_documentation has the correct keys"); is $api->pet_api->method_documentation->{get_pet_by_id}->{params}->{pet_id}->{description}, - 'ID of pet that needs to be fetched', 'get_pet_by_id parameter pet_id description is correct'; + 'ID of pet to return', 'get_pet_by_id parameter pet_id description is correct'; is $api->pet_api->method_documentation->{get_pet_by_id}->{params}->{pet_id}->{required}, 1, 'get_pet_by_id parameter pet_id is required'; is $api->pet_api->method_documentation->{get_pet_by_id}->{params}->{pet_id}->{data_type},