diff --git a/modules/openapi-generator/src/main/resources/perl/BaseObject.mustache b/modules/openapi-generator/src/main/resources/perl/BaseObject.mustache index 3e7337eb82b2..b9c0f102961b 100644 --- a/modules/openapi-generator/src/main/resources/perl/BaseObject.mustache +++ b/modules/openapi-generator/src/main/resources/perl/BaseObject.mustache @@ -74,13 +74,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -100,7 +107,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index af79bc8ff734..ceba27d0b854 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -222,6 +222,7 @@ Each of these calls returns a hashref with various useful pieces of information. To load the API packages: ```perl use WWW::OpenAPIClient::AnotherFakeApi; +use WWW::OpenAPIClient::DefaultApi; use WWW::OpenAPIClient::FakeApi; use WWW::OpenAPIClient::FakeClassnameTags123Api; use WWW::OpenAPIClient::PetApi; @@ -249,18 +250,31 @@ use WWW::OpenAPIClient::Object::EnumClass; use WWW::OpenAPIClient::Object::EnumTest; use WWW::OpenAPIClient::Object::File; use WWW::OpenAPIClient::Object::FileSchemaTestClass; +use WWW::OpenAPIClient::Object::Foo; use WWW::OpenAPIClient::Object::FormatTest; use WWW::OpenAPIClient::Object::HasOnlyReadOnly; +use WWW::OpenAPIClient::Object::HealthCheckResult; +use WWW::OpenAPIClient::Object::InlineObject; +use WWW::OpenAPIClient::Object::InlineObject1; +use WWW::OpenAPIClient::Object::InlineObject2; +use WWW::OpenAPIClient::Object::InlineObject3; +use WWW::OpenAPIClient::Object::InlineObject4; +use WWW::OpenAPIClient::Object::InlineObject5; +use WWW::OpenAPIClient::Object::InlineResponseDefault; use WWW::OpenAPIClient::Object::List; use WWW::OpenAPIClient::Object::MapTest; use WWW::OpenAPIClient::Object::MixedPropertiesAndAdditionalPropertiesClass; use WWW::OpenAPIClient::Object::Model200Response; use WWW::OpenAPIClient::Object::ModelReturn; use WWW::OpenAPIClient::Object::Name; +use WWW::OpenAPIClient::Object::NullableClass; use WWW::OpenAPIClient::Object::NumberOnly; use WWW::OpenAPIClient::Object::Order; use WWW::OpenAPIClient::Object::OuterComposite; use WWW::OpenAPIClient::Object::OuterEnum; +use WWW::OpenAPIClient::Object::OuterEnumDefaultValue; +use WWW::OpenAPIClient::Object::OuterEnumInteger; +use WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue; use WWW::OpenAPIClient::Object::Pet; use WWW::OpenAPIClient::Object::ReadOnlyFirst; use WWW::OpenAPIClient::Object::SpecialModelName; @@ -278,6 +292,7 @@ use strict; use warnings; # load the API package use WWW::OpenAPIClient::AnotherFakeApi; +use WWW::OpenAPIClient::DefaultApi; use WWW::OpenAPIClient::FakeApi; use WWW::OpenAPIClient::FakeClassnameTags123Api; use WWW::OpenAPIClient::PetApi; @@ -302,18 +317,31 @@ use WWW::OpenAPIClient::Object::EnumClass; use WWW::OpenAPIClient::Object::EnumTest; use WWW::OpenAPIClient::Object::File; use WWW::OpenAPIClient::Object::FileSchemaTestClass; +use WWW::OpenAPIClient::Object::Foo; use WWW::OpenAPIClient::Object::FormatTest; use WWW::OpenAPIClient::Object::HasOnlyReadOnly; +use WWW::OpenAPIClient::Object::HealthCheckResult; +use WWW::OpenAPIClient::Object::InlineObject; +use WWW::OpenAPIClient::Object::InlineObject1; +use WWW::OpenAPIClient::Object::InlineObject2; +use WWW::OpenAPIClient::Object::InlineObject3; +use WWW::OpenAPIClient::Object::InlineObject4; +use WWW::OpenAPIClient::Object::InlineObject5; +use WWW::OpenAPIClient::Object::InlineResponseDefault; use WWW::OpenAPIClient::Object::List; use WWW::OpenAPIClient::Object::MapTest; use WWW::OpenAPIClient::Object::MixedPropertiesAndAdditionalPropertiesClass; use WWW::OpenAPIClient::Object::Model200Response; use WWW::OpenAPIClient::Object::ModelReturn; use WWW::OpenAPIClient::Object::Name; +use WWW::OpenAPIClient::Object::NullableClass; use WWW::OpenAPIClient::Object::NumberOnly; use WWW::OpenAPIClient::Object::Order; use WWW::OpenAPIClient::Object::OuterComposite; use WWW::OpenAPIClient::Object::OuterEnum; +use WWW::OpenAPIClient::Object::OuterEnumDefaultValue; +use WWW::OpenAPIClient::Object::OuterEnumInteger; +use WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue; use WWW::OpenAPIClient::Object::Pet; use WWW::OpenAPIClient::Object::ReadOnlyFirst; use WWW::OpenAPIClient::Object::SpecialModelName; @@ -327,10 +355,10 @@ use WWW::OpenAPIClient::; my $api_instance = WWW::OpenAPIClient::->new( ); -my $body = WWW::OpenAPIClient::Object::Client->new(); # Client | client model +my $client = WWW::OpenAPIClient::Object::Client->new(); # Client | client model eval { - my $result = $api_instance->call_123_test_special_tags(body => $body); + my $result = $api_instance->call_123_test_special_tags(client => $client); print Dumper($result); }; if ($@) { @@ -346,6 +374,8 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags +*DefaultApi* | [**foo_get**](docs/DefaultApi.md#foo_get) | **GET** /foo | +*FakeApi* | [**fake_health_get**](docs/FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint *FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | *FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | @@ -400,18 +430,31 @@ Class | Method | HTTP request | Description - [WWW::OpenAPIClient::Object::EnumTest](docs/EnumTest.md) - [WWW::OpenAPIClient::Object::File](docs/File.md) - [WWW::OpenAPIClient::Object::FileSchemaTestClass](docs/FileSchemaTestClass.md) + - [WWW::OpenAPIClient::Object::Foo](docs/Foo.md) - [WWW::OpenAPIClient::Object::FormatTest](docs/FormatTest.md) - [WWW::OpenAPIClient::Object::HasOnlyReadOnly](docs/HasOnlyReadOnly.md) + - [WWW::OpenAPIClient::Object::HealthCheckResult](docs/HealthCheckResult.md) + - [WWW::OpenAPIClient::Object::InlineObject](docs/InlineObject.md) + - [WWW::OpenAPIClient::Object::InlineObject1](docs/InlineObject1.md) + - [WWW::OpenAPIClient::Object::InlineObject2](docs/InlineObject2.md) + - [WWW::OpenAPIClient::Object::InlineObject3](docs/InlineObject3.md) + - [WWW::OpenAPIClient::Object::InlineObject4](docs/InlineObject4.md) + - [WWW::OpenAPIClient::Object::InlineObject5](docs/InlineObject5.md) + - [WWW::OpenAPIClient::Object::InlineResponseDefault](docs/InlineResponseDefault.md) - [WWW::OpenAPIClient::Object::List](docs/List.md) - [WWW::OpenAPIClient::Object::MapTest](docs/MapTest.md) - [WWW::OpenAPIClient::Object::MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - [WWW::OpenAPIClient::Object::Model200Response](docs/Model200Response.md) - [WWW::OpenAPIClient::Object::ModelReturn](docs/ModelReturn.md) - [WWW::OpenAPIClient::Object::Name](docs/Name.md) + - [WWW::OpenAPIClient::Object::NullableClass](docs/NullableClass.md) - [WWW::OpenAPIClient::Object::NumberOnly](docs/NumberOnly.md) - [WWW::OpenAPIClient::Object::Order](docs/Order.md) - [WWW::OpenAPIClient::Object::OuterComposite](docs/OuterComposite.md) - [WWW::OpenAPIClient::Object::OuterEnum](docs/OuterEnum.md) + - [WWW::OpenAPIClient::Object::OuterEnumDefaultValue](docs/OuterEnumDefaultValue.md) + - [WWW::OpenAPIClient::Object::OuterEnumInteger](docs/OuterEnumInteger.md) + - [WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md) - [WWW::OpenAPIClient::Object::Pet](docs/Pet.md) - [WWW::OpenAPIClient::Object::ReadOnlyFirst](docs/ReadOnlyFirst.md) - [WWW::OpenAPIClient::Object::SpecialModelName](docs/SpecialModelName.md) @@ -433,6 +476,10 @@ Class | Method | HTTP request | Description - **API key parameter name**: api_key_query - **Location**: URL query string +## bearer_test + +- **Type**: HTTP basic authentication + ## http_basic_test - **Type**: HTTP basic authentication diff --git a/samples/client/petstore/perl/docs/AdditionalPropertiesAnyType.md b/samples/client/petstore/perl/docs/AdditionalPropertiesAnyType.md new file mode 100644 index 000000000000..26f619b17ab8 --- /dev/null +++ b/samples/client/petstore/perl/docs/AdditionalPropertiesAnyType.md @@ -0,0 +1,15 @@ +# WWW::OpenAPIClient::Object::AdditionalPropertiesAnyType + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::AdditionalPropertiesAnyType; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | [optional] + +[[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/AdditionalPropertiesArray.md b/samples/client/petstore/perl/docs/AdditionalPropertiesArray.md new file mode 100644 index 000000000000..ecd3c7d28b08 --- /dev/null +++ b/samples/client/petstore/perl/docs/AdditionalPropertiesArray.md @@ -0,0 +1,15 @@ +# WWW::OpenAPIClient::Object::AdditionalPropertiesArray + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::AdditionalPropertiesArray; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | [optional] + +[[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/AdditionalPropertiesBoolean.md b/samples/client/petstore/perl/docs/AdditionalPropertiesBoolean.md new file mode 100644 index 000000000000..db7b80c7c1c6 --- /dev/null +++ b/samples/client/petstore/perl/docs/AdditionalPropertiesBoolean.md @@ -0,0 +1,15 @@ +# WWW::OpenAPIClient::Object::AdditionalPropertiesBoolean + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::AdditionalPropertiesBoolean; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | [optional] + +[[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/AdditionalPropertiesInteger.md b/samples/client/petstore/perl/docs/AdditionalPropertiesInteger.md new file mode 100644 index 000000000000..c1daff0754a9 --- /dev/null +++ b/samples/client/petstore/perl/docs/AdditionalPropertiesInteger.md @@ -0,0 +1,15 @@ +# WWW::OpenAPIClient::Object::AdditionalPropertiesInteger + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::AdditionalPropertiesInteger; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | [optional] + +[[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/AdditionalPropertiesNumber.md b/samples/client/petstore/perl/docs/AdditionalPropertiesNumber.md new file mode 100644 index 000000000000..158c325d40ed --- /dev/null +++ b/samples/client/petstore/perl/docs/AdditionalPropertiesNumber.md @@ -0,0 +1,15 @@ +# WWW::OpenAPIClient::Object::AdditionalPropertiesNumber + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::AdditionalPropertiesNumber; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | [optional] + +[[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/AdditionalPropertiesObject.md b/samples/client/petstore/perl/docs/AdditionalPropertiesObject.md new file mode 100644 index 000000000000..1c09e4ec6089 --- /dev/null +++ b/samples/client/petstore/perl/docs/AdditionalPropertiesObject.md @@ -0,0 +1,15 @@ +# WWW::OpenAPIClient::Object::AdditionalPropertiesObject + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::AdditionalPropertiesObject; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | [optional] + +[[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/AdditionalPropertiesString.md b/samples/client/petstore/perl/docs/AdditionalPropertiesString.md new file mode 100644 index 000000000000..e8f4ea315fea --- /dev/null +++ b/samples/client/petstore/perl/docs/AdditionalPropertiesString.md @@ -0,0 +1,15 @@ +# WWW::OpenAPIClient::Object::AdditionalPropertiesString + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::AdditionalPropertiesString; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | | [optional] + +[[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/AnotherfakeApi.md b/samples/client/petstore/perl/docs/AnotherfakeApi.md index 87c9e4015b79..a0b0fd6f8ea7 100644 --- a/samples/client/petstore/perl/docs/AnotherfakeApi.md +++ b/samples/client/petstore/perl/docs/AnotherfakeApi.md @@ -13,7 +13,7 @@ Method | HTTP request | Description # **call_123_test_special_tags** -> Client call_123_test_special_tags(body => $body) +> Client call_123_test_special_tags(client => $client) To test special tags @@ -26,10 +26,10 @@ use WWW::OpenAPIClient::AnotherFakeApi; my $api_instance = WWW::OpenAPIClient::AnotherFakeApi->new( ); -my $body = WWW::OpenAPIClient::Object::Client->new(); # Client | client model +my $client = WWW::OpenAPIClient::Object::Client->new(); # Client | client model eval { - my $result = $api_instance->call_123_test_special_tags(body => $body); + my $result = $api_instance->call_123_test_special_tags(client => $client); print Dumper($result); }; if ($@) { @@ -41,7 +41,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md)| client model | ### Return type diff --git a/samples/client/petstore/perl/docs/EnumTest.md b/samples/client/petstore/perl/docs/EnumTest.md index aa889b2be864..60ed7418d2a5 100644 --- a/samples/client/petstore/perl/docs/EnumTest.md +++ b/samples/client/petstore/perl/docs/EnumTest.md @@ -13,6 +13,9 @@ Name | Type | Description | Notes **enum_integer** | **int** | | [optional] **enum_number** | **double** | | [optional] **outer_enum** | [**OuterEnum**](OuterEnum.md) | | [optional] +**outer_enum_integer** | [**OuterEnumInteger**](OuterEnumInteger.md) | | [optional] +**outer_enum_default_value** | [**OuterEnumDefaultValue**](OuterEnumDefaultValue.md) | | [optional] +**outer_enum_integer_default_value** | [**OuterEnumIntegerDefaultValue**](OuterEnumIntegerDefaultValue.md) | | [optional] [[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/FakeApi.md b/samples/client/petstore/perl/docs/FakeApi.md index 29404eab492e..8e9833fab199 100644 --- a/samples/client/petstore/perl/docs/FakeApi.md +++ b/samples/client/petstore/perl/docs/FakeApi.md @@ -9,6 +9,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fake_health_get**](FakeApi.md#fake_health_get) | **GET** /fake/health | Health check endpoint [**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | @@ -23,6 +24,46 @@ Method | HTTP request | Description [**test_json_form_data**](FakeApi.md#test_json_form_data) | **GET** /fake/jsonFormData | test json serialization of form data +# **fake_health_get** +> HealthCheckResult fake_health_get() + +Health check endpoint + +### Example +```perl +use Data::Dumper; +use WWW::OpenAPIClient::FakeApi; +my $api_instance = WWW::OpenAPIClient::FakeApi->new( +); + + +eval { + my $result = $api_instance->fake_health_get(); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling FakeApi->fake_health_get: $@\n"; +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**HealthCheckResult**](HealthCheckResult.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **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) + # **fake_outer_boolean_serialize** > boolean fake_outer_boolean_serialize(body => $body) @@ -64,13 +105,13 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: */* [[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) # **fake_outer_composite_serialize** -> OuterComposite fake_outer_composite_serialize(body => $body) +> OuterComposite fake_outer_composite_serialize(outer_composite => $outer_composite) @@ -83,10 +124,10 @@ use WWW::OpenAPIClient::FakeApi; my $api_instance = WWW::OpenAPIClient::FakeApi->new( ); -my $body = WWW::OpenAPIClient::Object::OuterComposite->new(); # OuterComposite | Input composite as post body +my $outer_composite = WWW::OpenAPIClient::Object::OuterComposite->new(); # OuterComposite | Input composite as post body eval { - my $result = $api_instance->fake_outer_composite_serialize(body => $body); + my $result = $api_instance->fake_outer_composite_serialize(outer_composite => $outer_composite); print Dumper($result); }; if ($@) { @@ -98,7 +139,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + **outer_composite** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] ### Return type @@ -110,7 +151,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: */* [[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) @@ -156,7 +197,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: */* [[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) @@ -202,13 +243,13 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: */* [[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) # **test_body_with_file_schema** -> test_body_with_file_schema(body => $body) +> test_body_with_file_schema(file_schema_test_class => $file_schema_test_class) @@ -221,10 +262,10 @@ use WWW::OpenAPIClient::FakeApi; my $api_instance = WWW::OpenAPIClient::FakeApi->new( ); -my $body = WWW::OpenAPIClient::Object::FileSchemaTestClass->new(); # FileSchemaTestClass | +my $file_schema_test_class = WWW::OpenAPIClient::Object::FileSchemaTestClass->new(); # FileSchemaTestClass | eval { - $api_instance->test_body_with_file_schema(body => $body); + $api_instance->test_body_with_file_schema(file_schema_test_class => $file_schema_test_class); }; if ($@) { warn "Exception when calling FakeApi->test_body_with_file_schema: $@\n"; @@ -235,7 +276,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + **file_schema_test_class** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | ### Return type @@ -253,7 +294,7 @@ No authorization required [[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) # **test_body_with_query_params** -> test_body_with_query_params(query => $query, body => $body) +> test_body_with_query_params(query => $query, user => $user) @@ -265,10 +306,10 @@ my $api_instance = WWW::OpenAPIClient::FakeApi->new( ); my $query = "query_example"; # string | -my $body = WWW::OpenAPIClient::Object::User->new(); # User | +my $user = WWW::OpenAPIClient::Object::User->new(); # User | eval { - $api_instance->test_body_with_query_params(query => $query, body => $body); + $api_instance->test_body_with_query_params(query => $query, user => $user); }; if ($@) { warn "Exception when calling FakeApi->test_body_with_query_params: $@\n"; @@ -280,7 +321,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **query** | **string**| | - **body** | [**User**](User.md)| | + **user** | [**User**](User.md)| | ### Return type @@ -298,7 +339,7 @@ No authorization required [[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) # **test_client_model** -> Client test_client_model(body => $body) +> Client test_client_model(client => $client) To test \"client\" model @@ -311,10 +352,10 @@ use WWW::OpenAPIClient::FakeApi; my $api_instance = WWW::OpenAPIClient::FakeApi->new( ); -my $body = WWW::OpenAPIClient::Object::Client->new(); # Client | client model +my $client = WWW::OpenAPIClient::Object::Client->new(); # Client | client model eval { - my $result = $api_instance->test_client_model(body => $body); + my $result = $api_instance->test_client_model(client => $client); print Dumper($result); }; if ($@) { @@ -326,7 +367,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md)| client model | ### Return type @@ -489,6 +530,10 @@ Fake endpoint to test group parameters (optional) use Data::Dumper; use WWW::OpenAPIClient::FakeApi; my $api_instance = WWW::OpenAPIClient::FakeApi->new( + + # Configure HTTP basic authorization: bearer_test + username => 'YOUR_USERNAME', + password => 'YOUR_PASSWORD', ); my $required_string_group = 56; # int | Required String in group parameters @@ -523,7 +568,7 @@ void (empty response body) ### Authorization -No authorization required +[bearer_test](../README.md#bearer_test) ### HTTP request headers @@ -533,7 +578,7 @@ No authorization required [[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) # **test_inline_additional_properties** -> test_inline_additional_properties(param => $param) +> test_inline_additional_properties(request_body => $request_body) test inline additionalProperties @@ -544,10 +589,10 @@ use WWW::OpenAPIClient::FakeApi; my $api_instance = WWW::OpenAPIClient::FakeApi->new( ); -my $param = WWW::OpenAPIClient::Object::HASH[string,string]->new(); # HASH[string,string] | request body +my $request_body = WWW::OpenAPIClient::Object::HASH[string,string]->new(); # HASH[string,string] | request body eval { - $api_instance->test_inline_additional_properties(param => $param); + $api_instance->test_inline_additional_properties(request_body => $request_body); }; if ($@) { warn "Exception when calling FakeApi->test_inline_additional_properties: $@\n"; @@ -558,7 +603,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | [**HASH[string,string]**](string.md)| request body | + **request_body** | [**HASH[string,string]**](string.md)| request body | ### Return type diff --git a/samples/client/petstore/perl/docs/FakeClassnameTags123Api.md b/samples/client/petstore/perl/docs/FakeClassnameTags123Api.md index 70e303f7bf0b..67c2122cb6ff 100644 --- a/samples/client/petstore/perl/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/perl/docs/FakeClassnameTags123Api.md @@ -13,7 +13,7 @@ Method | HTTP request | Description # **test_classname** -> Client test_classname(body => $body) +> Client test_classname(client => $client) To test class name in snake case @@ -31,10 +31,10 @@ my $api_instance = WWW::OpenAPIClient::FakeClassnameTags123Api->new( #api_key_prefix => {'api_key_query' => 'Bearer'}, ); -my $body = WWW::OpenAPIClient::Object::Client->new(); # Client | client model +my $client = WWW::OpenAPIClient::Object::Client->new(); # Client | client model eval { - my $result = $api_instance->test_classname(body => $body); + my $result = $api_instance->test_classname(client => $client); print Dumper($result); }; if ($@) { @@ -46,7 +46,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md)| client model | ### Return type diff --git a/samples/client/petstore/perl/docs/FormatTest.md b/samples/client/petstore/perl/docs/FormatTest.md index 3a1bf2c21f3c..7cfabebb2813 100644 --- a/samples/client/petstore/perl/docs/FormatTest.md +++ b/samples/client/petstore/perl/docs/FormatTest.md @@ -21,6 +21,8 @@ Name | Type | Description | Notes **date_time** | **DateTime** | | [optional] **uuid** | **string** | | [optional] **password** | **string** | | +**pattern_with_digits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] +**pattern_with_digits_and_delimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] [[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/HealthCheckResult.md b/samples/client/petstore/perl/docs/HealthCheckResult.md new file mode 100644 index 000000000000..5f0c43d5f3d4 --- /dev/null +++ b/samples/client/petstore/perl/docs/HealthCheckResult.md @@ -0,0 +1,15 @@ +# WWW::OpenAPIClient::Object::HealthCheckResult + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::HealthCheckResult; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nullable_message** | **string** | | [optional] + +[[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/NullableClass.md b/samples/client/petstore/perl/docs/NullableClass.md new file mode 100644 index 000000000000..326c42317cb8 --- /dev/null +++ b/samples/client/petstore/perl/docs/NullableClass.md @@ -0,0 +1,26 @@ +# WWW::OpenAPIClient::Object::NullableClass + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::NullableClass; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer_prop** | **int** | | [optional] +**number_prop** | **double** | | [optional] +**boolean_prop** | **boolean** | | [optional] +**string_prop** | **string** | | [optional] +**date_prop** | **DateTime** | | [optional] +**datetime_prop** | **DateTime** | | [optional] +**array_nullable_prop** | **ARRAY[object]** | | [optional] +**array_and_items_nullable_prop** | **ARRAY[object]** | | [optional] +**array_items_nullable** | **ARRAY[object]** | | [optional] +**object_nullable_prop** | **HASH[string,object]** | | [optional] +**object_and_items_nullable_prop** | **HASH[string,object]** | | [optional] +**object_items_nullable** | **HASH[string,object]** | | [optional] + +[[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/OuterEnumDefaultValue.md b/samples/client/petstore/perl/docs/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..f770b123eae2 --- /dev/null +++ b/samples/client/petstore/perl/docs/OuterEnumDefaultValue.md @@ -0,0 +1,14 @@ +# WWW::OpenAPIClient::Object::OuterEnumDefaultValue + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::OuterEnumDefaultValue; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/OuterEnumInteger.md b/samples/client/petstore/perl/docs/OuterEnumInteger.md new file mode 100644 index 000000000000..a569e6cb2bab --- /dev/null +++ b/samples/client/petstore/perl/docs/OuterEnumInteger.md @@ -0,0 +1,14 @@ +# WWW::OpenAPIClient::Object::OuterEnumInteger + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::OuterEnumInteger; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/perl/docs/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..dbf7d98f094c --- /dev/null +++ b/samples/client/petstore/perl/docs/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,14 @@ +# WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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 899e2f63e074..5218d9282f19 100644 --- a/samples/client/petstore/perl/docs/PetApi.md +++ b/samples/client/petstore/perl/docs/PetApi.md @@ -21,7 +21,7 @@ Method | HTTP request | Description # **add_pet** -> add_pet(body => $body) +> add_pet(pet => $pet) Add a new pet to the store @@ -35,10 +35,10 @@ my $api_instance = WWW::OpenAPIClient::PetApi->new( access_token => 'YOUR_ACCESS_TOKEN', ); -my $body = WWW::OpenAPIClient::Object::Pet->new(); # Pet | Pet object that needs to be added to the store +my $pet = WWW::OpenAPIClient::Object::Pet->new(); # Pet | Pet object that needs to be added to the store eval { - $api_instance->add_pet(body => $body); + $api_instance->add_pet(pet => $pet); }; if ($@) { warn "Exception when calling PetApi->add_pet: $@\n"; @@ -49,7 +49,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -264,7 +264,7 @@ Name | Type | Description | Notes [[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) # **update_pet** -> update_pet(body => $body) +> update_pet(pet => $pet) Update an existing pet @@ -278,10 +278,10 @@ my $api_instance = WWW::OpenAPIClient::PetApi->new( access_token => 'YOUR_ACCESS_TOKEN', ); -my $body = WWW::OpenAPIClient::Object::Pet->new(); # Pet | Pet object that needs to be added to the store +my $pet = WWW::OpenAPIClient::Object::Pet->new(); # Pet | Pet object that needs to be added to the store eval { - $api_instance->update_pet(body => $body); + $api_instance->update_pet(pet => $pet); }; if ($@) { warn "Exception when calling PetApi->update_pet: $@\n"; @@ -292,7 +292,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type diff --git a/samples/client/petstore/perl/docs/StoreApi.md b/samples/client/petstore/perl/docs/StoreApi.md index fe591e701a82..e467823c53a9 100644 --- a/samples/client/petstore/perl/docs/StoreApi.md +++ b/samples/client/petstore/perl/docs/StoreApi.md @@ -154,7 +154,7 @@ No authorization required [[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) # **place_order** -> Order place_order(body => $body) +> Order place_order(order => $order) Place an order for a pet @@ -165,10 +165,10 @@ use WWW::OpenAPIClient::StoreApi; my $api_instance = WWW::OpenAPIClient::StoreApi->new( ); -my $body = WWW::OpenAPIClient::Object::Order->new(); # Order | order placed for purchasing the pet +my $order = WWW::OpenAPIClient::Object::Order->new(); # Order | order placed for purchasing the pet eval { - my $result = $api_instance->place_order(body => $body); + my $result = $api_instance->place_order(order => $order); print Dumper($result); }; if ($@) { @@ -180,7 +180,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | + **order** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type @@ -192,7 +192,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **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/TypeHolderDefault.md b/samples/client/petstore/perl/docs/TypeHolderDefault.md new file mode 100644 index 000000000000..7fcd7ed9e53e --- /dev/null +++ b/samples/client/petstore/perl/docs/TypeHolderDefault.md @@ -0,0 +1,19 @@ +# WWW::OpenAPIClient::Object::TypeHolderDefault + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::TypeHolderDefault; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string_item** | **string** | | [default to 'what'] +**number_item** | **double** | | +**integer_item** | **int** | | +**bool_item** | **boolean** | | [default to true] +**array_item** | **ARRAY[int]** | | + +[[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/TypeHolderExample.md b/samples/client/petstore/perl/docs/TypeHolderExample.md new file mode 100644 index 000000000000..2f83a6109199 --- /dev/null +++ b/samples/client/petstore/perl/docs/TypeHolderExample.md @@ -0,0 +1,19 @@ +# WWW::OpenAPIClient::Object::TypeHolderExample + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::TypeHolderExample; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string_item** | **string** | | +**number_item** | **double** | | +**integer_item** | **int** | | +**bool_item** | **boolean** | | +**array_item** | **ARRAY[int]** | | + +[[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/UserApi.md b/samples/client/petstore/perl/docs/UserApi.md index caa7684785bc..ebe449515cb1 100644 --- a/samples/client/petstore/perl/docs/UserApi.md +++ b/samples/client/petstore/perl/docs/UserApi.md @@ -20,7 +20,7 @@ Method | HTTP request | Description # **create_user** -> create_user(body => $body) +> create_user(user => $user) Create user @@ -33,10 +33,10 @@ use WWW::OpenAPIClient::UserApi; my $api_instance = WWW::OpenAPIClient::UserApi->new( ); -my $body = WWW::OpenAPIClient::Object::User->new(); # User | Created user object +my $user = WWW::OpenAPIClient::Object::User->new(); # User | Created user object eval { - $api_instance->create_user(body => $body); + $api_instance->create_user(user => $user); }; if ($@) { warn "Exception when calling UserApi->create_user: $@\n"; @@ -47,7 +47,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | + **user** | [**User**](User.md)| Created user object | ### Return type @@ -59,13 +59,13 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined [[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) # **create_users_with_array_input** -> create_users_with_array_input(body => $body) +> create_users_with_array_input(user => $user) Creates list of users with given input array @@ -76,10 +76,10 @@ use WWW::OpenAPIClient::UserApi; my $api_instance = WWW::OpenAPIClient::UserApi->new( ); -my $body = [WWW::OpenAPIClient::Object::ARRAY[User]->new()]; # ARRAY[User] | List of user object +my $user = [WWW::OpenAPIClient::Object::ARRAY[User]->new()]; # ARRAY[User] | List of user object eval { - $api_instance->create_users_with_array_input(body => $body); + $api_instance->create_users_with_array_input(user => $user); }; if ($@) { warn "Exception when calling UserApi->create_users_with_array_input: $@\n"; @@ -90,7 +90,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**ARRAY[User]**](ARRAY.md)| List of user object | + **user** | [**ARRAY[User]**](ARRAY.md)| List of user object | ### Return type @@ -102,13 +102,13 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined [[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) # **create_users_with_list_input** -> create_users_with_list_input(body => $body) +> create_users_with_list_input(user => $user) Creates list of users with given input array @@ -119,10 +119,10 @@ use WWW::OpenAPIClient::UserApi; my $api_instance = WWW::OpenAPIClient::UserApi->new( ); -my $body = [WWW::OpenAPIClient::Object::ARRAY[User]->new()]; # ARRAY[User] | List of user object +my $user = [WWW::OpenAPIClient::Object::ARRAY[User]->new()]; # ARRAY[User] | List of user object eval { - $api_instance->create_users_with_list_input(body => $body); + $api_instance->create_users_with_list_input(user => $user); }; if ($@) { warn "Exception when calling UserApi->create_users_with_list_input: $@\n"; @@ -133,7 +133,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**ARRAY[User]**](ARRAY.md)| List of user object | + **user** | [**ARRAY[User]**](ARRAY.md)| List of user object | ### Return type @@ -145,7 +145,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined [[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) @@ -325,7 +325,7 @@ No authorization required [[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) # **update_user** -> update_user(username => $username, body => $body) +> update_user(username => $username, user => $user) Updated user @@ -339,10 +339,10 @@ my $api_instance = WWW::OpenAPIClient::UserApi->new( ); my $username = "username_example"; # string | name that need to be deleted -my $body = WWW::OpenAPIClient::Object::User->new(); # User | Updated user object +my $user = WWW::OpenAPIClient::Object::User->new(); # User | Updated user object eval { - $api_instance->update_user(username => $username, body => $body); + $api_instance->update_user(username => $username, user => $user); }; if ($@) { warn "Exception when calling UserApi->update_user: $@\n"; @@ -354,7 +354,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **string**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | + **user** | [**User**](User.md)| Updated user object | ### Return type @@ -366,7 +366,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: Not defined [[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/XmlItem.md b/samples/client/petstore/perl/docs/XmlItem.md new file mode 100644 index 000000000000..f3350ea89dee --- /dev/null +++ b/samples/client/petstore/perl/docs/XmlItem.md @@ -0,0 +1,43 @@ +# WWW::OpenAPIClient::Object::XmlItem + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::XmlItem; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**attribute_string** | **string** | | [optional] +**attribute_number** | **double** | | [optional] +**attribute_integer** | **int** | | [optional] +**attribute_boolean** | **boolean** | | [optional] +**wrapped_array** | **ARRAY[int]** | | [optional] +**name_string** | **string** | | [optional] +**name_number** | **double** | | [optional] +**name_integer** | **int** | | [optional] +**name_boolean** | **boolean** | | [optional] +**name_array** | **ARRAY[int]** | | [optional] +**name_wrapped_array** | **ARRAY[int]** | | [optional] +**prefix_string** | **string** | | [optional] +**prefix_number** | **double** | | [optional] +**prefix_integer** | **int** | | [optional] +**prefix_boolean** | **boolean** | | [optional] +**prefix_array** | **ARRAY[int]** | | [optional] +**prefix_wrapped_array** | **ARRAY[int]** | | [optional] +**namespace_string** | **string** | | [optional] +**namespace_number** | **double** | | [optional] +**namespace_integer** | **int** | | [optional] +**namespace_boolean** | **boolean** | | [optional] +**namespace_array** | **ARRAY[int]** | | [optional] +**namespace_wrapped_array** | **ARRAY[int]** | | [optional] +**prefix_ns_string** | **string** | | [optional] +**prefix_ns_number** | **double** | | [optional] +**prefix_ns_integer** | **int** | | [optional] +**prefix_ns_boolean** | **boolean** | | [optional] +**prefix_ns_array** | **ARRAY[int]** | | [optional] +**prefix_ns_wrapped_array** | **ARRAY[int]** | | [optional] + +[[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/lib/WWW/OpenAPIClient/AnotherFakeApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/AnotherFakeApi.pm index ed6f6470c598..84a7c522e698 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/AnotherFakeApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/AnotherFakeApi.pm @@ -53,10 +53,10 @@ sub new { # # To test special tags # -# @param Client $body client model (required) +# @param Client $client client model (required) { my $params = { - 'body' => { + 'client' => { data_type => 'Client', description => 'client model', required => '1', @@ -73,9 +73,9 @@ sub new { sub call_123_test_special_tags { my ($self, %args) = @_; - # verify the required parameter 'body' is set - unless (exists $args{'body'}) { - croak("Missing the required parameter 'body' when calling call_123_test_special_tags"); + # verify the required parameter 'client' is set + unless (exists $args{'client'}) { + croak("Missing the required parameter 'client' when calling call_123_test_special_tags"); } # parse inputs @@ -95,8 +95,8 @@ sub call_123_test_special_tags { my $_body_data; # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; + if ( exists $args{'client'}) { + $_body_data = $args{'client'}; } # authentication setting, if any diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm index 1220484ae4ae..42f65e5077e8 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm @@ -348,6 +348,11 @@ sub update_params_for_auth { $query_params->{'api_key_query'} = $api_key; } } + elsif ($auth eq 'bearer_test') { + if ($self->{config}{username} || $self->{config}{password}) { + $header_params->{'Authorization'} = 'Basic ' . encode_base64($self->{config}{username} . ":" . $self->{config}{password}); + } + } elsif ($auth eq 'http_basic_test') { if ($self->{config}{username} || $self->{config}{password}) { $header_params->{'Authorization'} = 'Basic ' . encode_base64($self->{config}{username} . ":" . $self->{config}{password}); diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm index dc1ce61d52ce..207807f79835 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm @@ -65,7 +65,7 @@ Hashref. Keyed on the name of each key (there can be multiple tokens). Note not secretKey => 'string', anotherKey => 'same or some other string', }; - + =item api_key_in: (optional) =item username: (optional) @@ -118,12 +118,12 @@ sub new { sub get_tokens { my $self = shift; - + my $tokens = {}; $tokens->{username} = $self->{username} if $self->{username}; $tokens->{password} = $self->{password} if $self->{password}; $tokens->{access_token} = $self->{access_token} if $self->{access_token}; - + foreach my $token_name (keys %{ $self->{api_key} }) { $tokens->{$token_name}->{token} = $self->{api_key}{$token_name}; $tokens->{$token_name}->{prefix} = $self->{api_key_prefix}{$token_name}; @@ -136,7 +136,7 @@ sub get_tokens { sub clear_tokens { my $self = shift; my %tokens = %{$self->get_tokens}; # copy - + $self->{username} = ''; $self->{password} = ''; $self->{access_token} = ''; @@ -144,18 +144,18 @@ sub clear_tokens { $self->{api_key} = {}; $self->{api_key_prefix} = {}; $self->{api_key_in} = {}; - + return \%tokens; } sub accept_tokens { my ($self, $tokens) = @_; - + foreach my $known_name (qw(username password access_token)) { next unless $tokens->{$known_name}; $self->{$known_name} = delete $tokens->{$known_name}; } - + foreach my $token_name (keys %$tokens) { $self->{api_key}{$token_name} = $tokens->{$token_name}{token}; if ($tokens->{$token_name}{prefix}) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/DefaultApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/DefaultApi.pm index 79a3811c1a14..abece6801b8b 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/DefaultApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/DefaultApi.pm @@ -57,7 +57,7 @@ sub new { my $params = { }; __PACKAGE__->method_documentation->{ 'foo_get' } = { - summary => '', + summary => '', params => $params, returns => 'InlineResponseDefault', }; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm index 61d021be3cb9..629d224ed09b 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm @@ -48,6 +48,55 @@ sub new { } +# +# fake_health_get +# +# Health check endpoint +# +{ + my $params = { + }; + __PACKAGE__->method_documentation->{ 'fake_health_get' } = { + summary => 'Health check endpoint', + params => $params, + returns => 'HealthCheckResult', + }; +} +# @return HealthCheckResult +# +sub fake_health_get { + my ($self, %args) = @_; + + # parse inputs + my $_resource_path = '/fake/health'; + + 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'); + 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()]; + + # 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('HealthCheckResult', $response); + return $_response_object; +} + # # fake_outer_boolean_serialize # @@ -86,7 +135,7 @@ sub fake_outer_boolean_serialize { if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); my $_body_data; # body params @@ -113,10 +162,10 @@ sub fake_outer_boolean_serialize { # # # -# @param OuterComposite $body Input composite as post body (optional) +# @param OuterComposite $outer_composite Input composite as post body (optional) { my $params = { - 'body' => { + 'outer_composite' => { data_type => 'OuterComposite', description => 'Input composite as post body', required => '0', @@ -146,12 +195,12 @@ sub fake_outer_composite_serialize { if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); my $_body_data; # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; + if ( exists $args{'outer_composite'}) { + $_body_data = $args{'outer_composite'}; } # authentication setting, if any @@ -206,7 +255,7 @@ sub fake_outer_number_serialize { if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); my $_body_data; # body params @@ -266,7 +315,7 @@ sub fake_outer_string_serialize { if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); my $_body_data; # body params @@ -293,10 +342,10 @@ sub fake_outer_string_serialize { # # # -# @param FileSchemaTestClass $body (required) +# @param FileSchemaTestClass $file_schema_test_class (required) { my $params = { - 'body' => { + 'file_schema_test_class' => { data_type => 'FileSchemaTestClass', description => '', required => '1', @@ -313,9 +362,9 @@ sub fake_outer_string_serialize { sub test_body_with_file_schema { my ($self, %args) = @_; - # verify the required parameter 'body' is set - unless (exists $args{'body'}) { - croak("Missing the required parameter 'body' when calling test_body_with_file_schema"); + # verify the required parameter 'file_schema_test_class' is set + unless (exists $args{'file_schema_test_class'}) { + croak("Missing the required parameter 'file_schema_test_class' when calling test_body_with_file_schema"); } # parse inputs @@ -335,8 +384,8 @@ sub test_body_with_file_schema { my $_body_data; # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; + if ( exists $args{'file_schema_test_class'}) { + $_body_data = $args{'file_schema_test_class'}; } # authentication setting, if any @@ -355,7 +404,7 @@ sub test_body_with_file_schema { # # # @param string $query (required) -# @param User $body (required) +# @param User $user (required) { my $params = { 'query' => { @@ -363,7 +412,7 @@ sub test_body_with_file_schema { description => '', required => '1', }, - 'body' => { + 'user' => { data_type => 'User', description => '', required => '1', @@ -385,9 +434,9 @@ sub test_body_with_query_params { croak("Missing the required parameter 'query' when calling test_body_with_query_params"); } - # verify the required parameter 'body' is set - unless (exists $args{'body'}) { - croak("Missing the required parameter 'body' when calling test_body_with_query_params"); + # verify the required parameter 'user' is set + unless (exists $args{'user'}) { + croak("Missing the required parameter 'user' when calling test_body_with_query_params"); } # parse inputs @@ -412,8 +461,8 @@ sub test_body_with_query_params { my $_body_data; # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; + if ( exists $args{'user'}) { + $_body_data = $args{'user'}; } # authentication setting, if any @@ -431,10 +480,10 @@ sub test_body_with_query_params { # # To test \"client\" model # -# @param Client $body client model (required) +# @param Client $client client model (required) { my $params = { - 'body' => { + 'client' => { data_type => 'Client', description => 'client model', required => '1', @@ -451,9 +500,9 @@ sub test_body_with_query_params { sub test_client_model { my ($self, %args) = @_; - # verify the required parameter 'body' is set - unless (exists $args{'body'}) { - croak("Missing the required parameter 'body' when calling test_client_model"); + # verify the required parameter 'client' is set + unless (exists $args{'client'}) { + croak("Missing the required parameter 'client' when calling test_client_model"); } # parse inputs @@ -473,8 +522,8 @@ sub test_client_model { my $_body_data; # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; + if ( exists $args{'client'}) { + $_body_data = $args{'client'}; } # authentication setting, if any @@ -961,7 +1010,7 @@ sub test_group_parameters { my $_body_data; # authentication setting, if any - my $auth_settings = [qw()]; + my $auth_settings = [qw(bearer_test )]; # make the API Call $self->{api_client}->call_api($_resource_path, $_method, @@ -975,10 +1024,10 @@ sub test_group_parameters { # # test inline additionalProperties # -# @param HASH[string,string] $param request body (required) +# @param HASH[string,string] $request_body request body (required) { my $params = { - 'param' => { + 'request_body' => { data_type => 'HASH[string,string]', description => 'request body', required => '1', @@ -995,9 +1044,9 @@ sub test_group_parameters { sub test_inline_additional_properties { my ($self, %args) = @_; - # verify the required parameter 'param' is set - unless (exists $args{'param'}) { - croak("Missing the required parameter 'param' when calling test_inline_additional_properties"); + # verify the required parameter 'request_body' is set + unless (exists $args{'request_body'}) { + croak("Missing the required parameter 'request_body' when calling test_inline_additional_properties"); } # parse inputs @@ -1017,8 +1066,8 @@ sub test_inline_additional_properties { my $_body_data; # body params - if ( exists $args{'param'}) { - $_body_data = $args{'param'}; + if ( exists $args{'request_body'}) { + $_body_data = $args{'request_body'}; } # authentication setting, if any diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeClassnameTags123Api.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeClassnameTags123Api.pm index c55bface1647..7e535503de6f 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeClassnameTags123Api.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeClassnameTags123Api.pm @@ -53,10 +53,10 @@ sub new { # # To test class name in snake case # -# @param Client $body client model (required) +# @param Client $client client model (required) { my $params = { - 'body' => { + 'client' => { data_type => 'Client', description => 'client model', required => '1', @@ -73,9 +73,9 @@ sub new { sub test_classname { my ($self, %args) = @_; - # verify the required parameter 'body' is set - unless (exists $args{'body'}) { - croak("Missing the required parameter 'body' when calling test_classname"); + # verify the required parameter 'client' is set + unless (exists $args{'client'}) { + croak("Missing the required parameter 'client' when calling test_classname"); } # parse inputs @@ -95,8 +95,8 @@ sub test_classname { my $_body_data; # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; + if ( exists $args{'client'}) { + $_body_data = $args{'client'}; } # authentication setting, if any diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesAnyType.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesAnyType.pm new file mode 100644 index 000000000000..8e30b03ea8f6 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesAnyType.pm @@ -0,0 +1,177 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::AdditionalPropertiesAnyType; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep {$type=~/^(ARRAY\[|HASH\[string,)?$_(\])?$/} ('int', 'double', 'string', 'boolean') ) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'AdditionalPropertiesAnyType', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'name' => { + datatype => 'string', + base_name => 'name', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'name' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'name' => 'name' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesArray.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesArray.pm new file mode 100644 index 000000000000..efc94b947784 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesArray.pm @@ -0,0 +1,177 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::AdditionalPropertiesArray; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep {$type=~/^(ARRAY\[|HASH\[string,)?$_(\])?$/} ('int', 'double', 'string', 'boolean') ) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'AdditionalPropertiesArray', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'name' => { + datatype => 'string', + base_name => 'name', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'name' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'name' => 'name' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesBoolean.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesBoolean.pm new file mode 100644 index 000000000000..b7268ad68a62 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesBoolean.pm @@ -0,0 +1,177 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::AdditionalPropertiesBoolean; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep {$type=~/^(ARRAY\[|HASH\[string,)?$_(\])?$/} ('int', 'double', 'string', 'boolean') ) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'AdditionalPropertiesBoolean', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'name' => { + datatype => 'string', + base_name => 'name', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'name' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'name' => 'name' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm index 760f6a54aa73..cefb055e3764 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesInteger.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesInteger.pm new file mode 100644 index 000000000000..da3887e899b1 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesInteger.pm @@ -0,0 +1,177 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::AdditionalPropertiesInteger; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep {$type=~/^(ARRAY\[|HASH\[string,)?$_(\])?$/} ('int', 'double', 'string', 'boolean') ) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'AdditionalPropertiesInteger', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'name' => { + datatype => 'string', + base_name => 'name', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'name' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'name' => 'name' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesNumber.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesNumber.pm new file mode 100644 index 000000000000..b742632d41ed --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesNumber.pm @@ -0,0 +1,177 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::AdditionalPropertiesNumber; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep {$type=~/^(ARRAY\[|HASH\[string,)?$_(\])?$/} ('int', 'double', 'string', 'boolean') ) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'AdditionalPropertiesNumber', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'name' => { + datatype => 'string', + base_name => 'name', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'name' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'name' => 'name' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesObject.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesObject.pm new file mode 100644 index 000000000000..bf10d33d38cd --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesObject.pm @@ -0,0 +1,177 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::AdditionalPropertiesObject; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep {$type=~/^(ARRAY\[|HASH\[string,)?$_(\])?$/} ('int', 'double', 'string', 'boolean') ) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'AdditionalPropertiesObject', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'name' => { + datatype => 'string', + base_name => 'name', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'name' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'name' => 'name' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesString.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesString.pm new file mode 100644 index 000000000000..594f8489c8e2 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesString.pm @@ -0,0 +1,177 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::AdditionalPropertiesString; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep {$type=~/^(ARRAY\[|HASH\[string,)?$_(\])?$/} ('int', 'double', 'string', 'boolean') ) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'AdditionalPropertiesString', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'name' => { + datatype => 'string', + base_name => 'name', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'name' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'name' => 'name' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm index 11bc3b7268a3..d9bc7ed50de1 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm index 82adad1fd29f..8a1cda357f06 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm index 32760ba6473e..0c540b94a845 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm index 85b5c34db640..e47232759974 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm index 598e1cb01471..cc342e699df7 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm @@ -115,13 +115,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -136,7 +143,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm index 7b6ca9d1d783..7f05a7352042 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm index 20d356f96584..9eba77c90c76 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm @@ -124,13 +124,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -148,7 +155,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm index 06c6d210bf34..e6eda282cf23 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm index 682b304f2cd4..124ecaaf8e8c 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm index 1f8c8ae89f8d..9870f0b2a2a4 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm index dc901ae14e9b..396bec58f588 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm @@ -124,13 +124,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -148,7 +155,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm index 949367b4f047..7abbe2666e9e 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm index dab3b1ef7166..31b0ba2a22ef 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm index 64e45ecc59bc..732e5b70eca2 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm @@ -31,6 +31,9 @@ use Date::Parse; use DateTime; use WWW::OpenAPIClient::Object::OuterEnum; +use WWW::OpenAPIClient::Object::OuterEnumDefaultValue; +use WWW::OpenAPIClient::Object::OuterEnumInteger; +use WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue; use base ("Class::Accessor", "Class::Data::Inheritable"); @@ -115,13 +118,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -136,7 +146,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { @@ -190,6 +200,27 @@ __PACKAGE__->method_documentation({ format => '', read_only => '', }, + 'outer_enum_integer' => { + datatype => 'OuterEnumInteger', + base_name => 'outerEnumInteger', + description => '', + format => '', + read_only => '', + }, + 'outer_enum_default_value' => { + datatype => 'OuterEnumDefaultValue', + base_name => 'outerEnumDefaultValue', + description => '', + format => '', + read_only => '', + }, + 'outer_enum_integer_default_value' => { + datatype => 'OuterEnumIntegerDefaultValue', + base_name => 'outerEnumIntegerDefaultValue', + description => '', + format => '', + read_only => '', + }, }); __PACKAGE__->openapi_types( { @@ -197,7 +228,10 @@ __PACKAGE__->openapi_types( { 'enum_string_required' => 'string', 'enum_integer' => 'int', 'enum_number' => 'double', - 'outer_enum' => 'OuterEnum' + 'outer_enum' => 'OuterEnum', + 'outer_enum_integer' => 'OuterEnumInteger', + 'outer_enum_default_value' => 'OuterEnumDefaultValue', + 'outer_enum_integer_default_value' => 'OuterEnumIntegerDefaultValue' } ); __PACKAGE__->attribute_map( { @@ -205,7 +239,10 @@ __PACKAGE__->attribute_map( { 'enum_string_required' => 'enum_string_required', 'enum_integer' => 'enum_integer', 'enum_number' => 'enum_number', - 'outer_enum' => 'outerEnum' + 'outer_enum' => 'outerEnum', + 'outer_enum_integer' => 'outerEnumInteger', + 'outer_enum_default_value' => 'outerEnumDefaultValue', + 'outer_enum_integer_default_value' => 'outerEnumIntegerDefaultValue' } ); __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm index 74fc8d23b024..6c3690620da0 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm index 9008f8ab2110..46643834502b 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm @@ -115,13 +115,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -136,7 +143,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Foo.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Foo.pm index 2ccc4a965850..8e76ee79d2ca 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Foo.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Foo.pm @@ -68,11 +68,11 @@ __PACKAGE__->mk_classdata('class_documentation' => {}); sub new { my ($class, %args) = @_; - my $self = bless {}, $class; + my $self = bless {}, $class; - $self->init(%args); - - return $self; + $self->init(%args); + + return $self; } # initialize the object @@ -80,10 +80,10 @@ sub init { my ($self, %args) = @_; - foreach my $attribute (keys %{$self->attribute_map}) { - my $args_key = $self->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } } # return perl hash @@ -113,18 +113,25 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); } } @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { @@ -155,12 +162,12 @@ __PACKAGE__->class_documentation({description => '', __PACKAGE__->method_documentation({ 'bar' => { - datatype => 'string', - base_name => 'bar', - description => '', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'bar', + description => '', + format => '', + read_only => '', + }, }); __PACKAGE__->openapi_types( { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm index 4b4b9839a37f..f8a7149a5a50 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { @@ -245,6 +252,20 @@ __PACKAGE__->method_documentation({ format => '', read_only => '', }, + 'pattern_with_digits' => { + datatype => 'string', + base_name => 'pattern_with_digits', + description => 'A string that is a 10 digit number. Can have leading zeros.', + format => '', + read_only => '', + }, + 'pattern_with_digits_and_delimiter' => { + datatype => 'string', + base_name => 'pattern_with_digits_and_delimiter', + description => 'A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.', + format => '', + read_only => '', + }, }); __PACKAGE__->openapi_types( { @@ -260,7 +281,9 @@ __PACKAGE__->openapi_types( { 'date' => 'DateTime', 'date_time' => 'DateTime', 'uuid' => 'string', - 'password' => 'string' + 'password' => 'string', + 'pattern_with_digits' => 'string', + 'pattern_with_digits_and_delimiter' => 'string' } ); __PACKAGE__->attribute_map( { @@ -276,7 +299,9 @@ __PACKAGE__->attribute_map( { 'date' => 'date', 'date_time' => 'dateTime', 'uuid' => 'uuid', - 'password' => 'password' + 'password' => 'password', + 'pattern_with_digits' => 'pattern_with_digits', + 'pattern_with_digits_and_delimiter' => 'pattern_with_digits_and_delimiter' } ); __PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm index 567dc8fde4ee..5a359791d26d 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HealthCheckResult.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HealthCheckResult.pm new file mode 100644 index 000000000000..31ee152b7b02 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HealthCheckResult.pm @@ -0,0 +1,184 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::HealthCheckResult; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +#Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => 'Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model.', + class => 'HealthCheckResult', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'nullable_message' => { + datatype => 'string', + base_name => 'NullableMessage', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'nullable_message' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'nullable_message' => 'NullableMessage' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject.pm index 929285419f49..47e9d20f2ff4 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject.pm @@ -68,11 +68,11 @@ __PACKAGE__->mk_classdata('class_documentation' => {}); sub new { my ($class, %args) = @_; - my $self = bless {}, $class; + my $self = bless {}, $class; - $self->init(%args); - - return $self; + $self->init(%args); + + return $self; } # initialize the object @@ -80,10 +80,10 @@ sub init { my ($self, %args) = @_; - foreach my $attribute (keys %{$self->attribute_map}) { - my $args_key = $self->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } } # return perl hash @@ -113,18 +113,25 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); } } @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { @@ -155,19 +162,19 @@ __PACKAGE__->class_documentation({description => '', __PACKAGE__->method_documentation({ 'name' => { - datatype => 'string', - base_name => 'name', - description => 'Updated name of the pet', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'name', + description => 'Updated name of the pet', + format => '', + read_only => '', + }, 'status' => { - datatype => 'string', - base_name => 'status', - description => 'Updated status of the pet', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'status', + description => 'Updated status of the pet', + format => '', + read_only => '', + }, }); __PACKAGE__->openapi_types( { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject1.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject1.pm index cc509cfad2be..387af5b55887 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject1.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject1.pm @@ -68,11 +68,11 @@ __PACKAGE__->mk_classdata('class_documentation' => {}); sub new { my ($class, %args) = @_; - my $self = bless {}, $class; + my $self = bless {}, $class; - $self->init(%args); - - return $self; + $self->init(%args); + + return $self; } # initialize the object @@ -80,10 +80,10 @@ sub init { my ($self, %args) = @_; - foreach my $attribute (keys %{$self->attribute_map}) { - my $args_key = $self->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } } # return perl hash @@ -113,18 +113,25 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); } } @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { @@ -155,19 +162,19 @@ __PACKAGE__->class_documentation({description => '', __PACKAGE__->method_documentation({ 'additional_metadata' => { - datatype => 'string', - base_name => 'additionalMetadata', - description => 'Additional data to pass to server', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'additionalMetadata', + description => 'Additional data to pass to server', + format => '', + read_only => '', + }, 'file' => { - datatype => 'string', - base_name => 'file', - description => 'file to upload', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'file', + description => 'file to upload', + format => '', + read_only => '', + }, }); __PACKAGE__->openapi_types( { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject2.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject2.pm index 5752717d8048..22b97d9da702 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject2.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject2.pm @@ -68,11 +68,11 @@ __PACKAGE__->mk_classdata('class_documentation' => {}); sub new { my ($class, %args) = @_; - my $self = bless {}, $class; + my $self = bless {}, $class; - $self->init(%args); - - return $self; + $self->init(%args); + + return $self; } # initialize the object @@ -80,10 +80,10 @@ sub init { my ($self, %args) = @_; - foreach my $attribute (keys %{$self->attribute_map}) { - my $args_key = $self->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } } # return perl hash @@ -113,18 +113,25 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); } } @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { @@ -155,19 +162,19 @@ __PACKAGE__->class_documentation({description => '', __PACKAGE__->method_documentation({ 'enum_form_string_array' => { - datatype => 'ARRAY[string]', - base_name => 'enum_form_string_array', - description => 'Form parameter enum test (string array)', - format => '', - read_only => '', - }, + datatype => 'ARRAY[string]', + base_name => 'enum_form_string_array', + description => 'Form parameter enum test (string array)', + format => '', + read_only => '', + }, 'enum_form_string' => { - datatype => 'string', - base_name => 'enum_form_string', - description => 'Form parameter enum test (string)', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'enum_form_string', + description => 'Form parameter enum test (string)', + format => '', + read_only => '', + }, }); __PACKAGE__->openapi_types( { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject3.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject3.pm index 3ac0f2a226b1..13dc5e455752 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject3.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject3.pm @@ -68,11 +68,11 @@ __PACKAGE__->mk_classdata('class_documentation' => {}); sub new { my ($class, %args) = @_; - my $self = bless {}, $class; + my $self = bless {}, $class; - $self->init(%args); - - return $self; + $self->init(%args); + + return $self; } # initialize the object @@ -80,10 +80,10 @@ sub init { my ($self, %args) = @_; - foreach my $attribute (keys %{$self->attribute_map}) { - my $args_key = $self->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } } # return perl hash @@ -113,18 +113,25 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); } } @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { @@ -155,103 +162,103 @@ __PACKAGE__->class_documentation({description => '', __PACKAGE__->method_documentation({ 'integer' => { - datatype => 'int', - base_name => 'integer', - description => 'None', - format => '', - read_only => '', - }, + datatype => 'int', + base_name => 'integer', + description => 'None', + format => '', + read_only => '', + }, 'int32' => { - datatype => 'int', - base_name => 'int32', - description => 'None', - format => '', - read_only => '', - }, + datatype => 'int', + base_name => 'int32', + description => 'None', + format => '', + read_only => '', + }, 'int64' => { - datatype => 'int', - base_name => 'int64', - description => 'None', - format => '', - read_only => '', - }, + datatype => 'int', + base_name => 'int64', + description => 'None', + format => '', + read_only => '', + }, 'number' => { - datatype => 'double', - base_name => 'number', - description => 'None', - format => '', - read_only => '', - }, + datatype => 'double', + base_name => 'number', + description => 'None', + format => '', + read_only => '', + }, 'float' => { - datatype => 'double', - base_name => 'float', - description => 'None', - format => '', - read_only => '', - }, + datatype => 'double', + base_name => 'float', + description => 'None', + format => '', + read_only => '', + }, 'double' => { - datatype => 'double', - base_name => 'double', - description => 'None', - format => '', - read_only => '', - }, + datatype => 'double', + base_name => 'double', + description => 'None', + format => '', + read_only => '', + }, 'string' => { - datatype => 'string', - base_name => 'string', - description => 'None', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'string', + description => 'None', + format => '', + read_only => '', + }, 'pattern_without_delimiter' => { - datatype => 'string', - base_name => 'pattern_without_delimiter', - description => 'None', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'pattern_without_delimiter', + description => 'None', + format => '', + read_only => '', + }, 'byte' => { - datatype => 'string', - base_name => 'byte', - description => 'None', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'byte', + description => 'None', + format => '', + read_only => '', + }, 'binary' => { - datatype => 'string', - base_name => 'binary', - description => 'None', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'binary', + description => 'None', + format => '', + read_only => '', + }, 'date' => { - datatype => 'DateTime', - base_name => 'date', - description => 'None', - format => '', - read_only => '', - }, + datatype => 'DateTime', + base_name => 'date', + description => 'None', + format => '', + read_only => '', + }, 'date_time' => { - datatype => 'DateTime', - base_name => 'dateTime', - description => 'None', - format => '', - read_only => '', - }, + datatype => 'DateTime', + base_name => 'dateTime', + description => 'None', + format => '', + read_only => '', + }, 'password' => { - datatype => 'string', - base_name => 'password', - description => 'None', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'password', + description => 'None', + format => '', + read_only => '', + }, 'callback' => { - datatype => 'string', - base_name => 'callback', - description => 'None', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'callback', + description => 'None', + format => '', + read_only => '', + }, }); __PACKAGE__->openapi_types( { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject4.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject4.pm index a25e8e451573..733bcd1b0ec4 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject4.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject4.pm @@ -68,11 +68,11 @@ __PACKAGE__->mk_classdata('class_documentation' => {}); sub new { my ($class, %args) = @_; - my $self = bless {}, $class; + my $self = bless {}, $class; - $self->init(%args); - - return $self; + $self->init(%args); + + return $self; } # initialize the object @@ -80,10 +80,10 @@ sub init { my ($self, %args) = @_; - foreach my $attribute (keys %{$self->attribute_map}) { - my $args_key = $self->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } } # return perl hash @@ -113,18 +113,25 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); } } @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { @@ -155,19 +162,19 @@ __PACKAGE__->class_documentation({description => '', __PACKAGE__->method_documentation({ 'param' => { - datatype => 'string', - base_name => 'param', - description => 'field1', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'param', + description => 'field1', + format => '', + read_only => '', + }, 'param2' => { - datatype => 'string', - base_name => 'param2', - description => 'field2', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'param2', + description => 'field2', + format => '', + read_only => '', + }, }); __PACKAGE__->openapi_types( { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject5.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject5.pm index 3c483c084584..f4a4fa7e18c5 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject5.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject5.pm @@ -68,11 +68,11 @@ __PACKAGE__->mk_classdata('class_documentation' => {}); sub new { my ($class, %args) = @_; - my $self = bless {}, $class; + my $self = bless {}, $class; - $self->init(%args); - - return $self; + $self->init(%args); + + return $self; } # initialize the object @@ -80,10 +80,10 @@ sub init { my ($self, %args) = @_; - foreach my $attribute (keys %{$self->attribute_map}) { - my $args_key = $self->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } } # return perl hash @@ -113,18 +113,25 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); } } @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { @@ -155,19 +162,19 @@ __PACKAGE__->class_documentation({description => '', __PACKAGE__->method_documentation({ 'additional_metadata' => { - datatype => 'string', - base_name => 'additionalMetadata', - description => 'Additional data to pass to server', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'additionalMetadata', + description => 'Additional data to pass to server', + format => '', + read_only => '', + }, 'required_file' => { - datatype => 'string', - base_name => 'requiredFile', - description => 'file to upload', - format => '', - read_only => '', - }, + datatype => 'string', + base_name => 'requiredFile', + description => 'file to upload', + format => '', + read_only => '', + }, }); __PACKAGE__->openapi_types( { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineResponseDefault.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineResponseDefault.pm index 4003f4a126c8..079d246db55f 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineResponseDefault.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineResponseDefault.pm @@ -69,11 +69,11 @@ __PACKAGE__->mk_classdata('class_documentation' => {}); sub new { my ($class, %args) = @_; - my $self = bless {}, $class; + my $self = bless {}, $class; - $self->init(%args); - - return $self; + $self->init(%args); + + return $self; } # initialize the object @@ -81,10 +81,10 @@ sub init { my ($self, %args) = @_; - foreach my $attribute (keys %{$self->attribute_map}) { - my $args_key = $self->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } } # return perl hash @@ -114,18 +114,25 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); } } @@ -136,7 +143,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { @@ -156,12 +163,12 @@ __PACKAGE__->class_documentation({description => '', __PACKAGE__->method_documentation({ 'string' => { - datatype => 'Foo', - base_name => 'string', - description => '', - format => '', - read_only => '', - }, + datatype => 'Foo', + base_name => 'string', + description => '', + format => '', + read_only => '', + }, }); __PACKAGE__->openapi_types( { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm index b3650dd58359..4ad74944ca98 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm index bad5e17f43b3..9964563a6fed 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm index c0597dde2772..251aabe1d61f 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm @@ -115,13 +115,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -136,7 +143,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm index 3d1cc902071c..e088706fe0ca 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm index 6e8afa5e19e6..530581cc0c66 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm index 03804d6146fb..9c00ad148942 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NullableClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NullableClass.pm new file mode 100644 index 000000000000..278360047467 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NullableClass.pm @@ -0,0 +1,283 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::NullableClass; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'NullableClass', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'integer_prop' => { + datatype => 'int', + base_name => 'integer_prop', + description => '', + format => '', + read_only => '', + }, + 'number_prop' => { + datatype => 'double', + base_name => 'number_prop', + description => '', + format => '', + read_only => '', + }, + 'boolean_prop' => { + datatype => 'boolean', + base_name => 'boolean_prop', + description => '', + format => '', + read_only => '', + }, + 'string_prop' => { + datatype => 'string', + base_name => 'string_prop', + description => '', + format => '', + read_only => '', + }, + 'date_prop' => { + datatype => 'DateTime', + base_name => 'date_prop', + description => '', + format => '', + read_only => '', + }, + 'datetime_prop' => { + datatype => 'DateTime', + base_name => 'datetime_prop', + description => '', + format => '', + read_only => '', + }, + 'array_nullable_prop' => { + datatype => 'ARRAY[object]', + base_name => 'array_nullable_prop', + description => '', + format => '', + read_only => '', + }, + 'array_and_items_nullable_prop' => { + datatype => 'ARRAY[object]', + base_name => 'array_and_items_nullable_prop', + description => '', + format => '', + read_only => '', + }, + 'array_items_nullable' => { + datatype => 'ARRAY[object]', + base_name => 'array_items_nullable', + description => '', + format => '', + read_only => '', + }, + 'object_nullable_prop' => { + datatype => 'HASH[string,object]', + base_name => 'object_nullable_prop', + description => '', + format => '', + read_only => '', + }, + 'object_and_items_nullable_prop' => { + datatype => 'HASH[string,object]', + base_name => 'object_and_items_nullable_prop', + description => '', + format => '', + read_only => '', + }, + 'object_items_nullable' => { + datatype => 'HASH[string,object]', + base_name => 'object_items_nullable', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'integer_prop' => 'int', + 'number_prop' => 'double', + 'boolean_prop' => 'boolean', + 'string_prop' => 'string', + 'date_prop' => 'DateTime', + 'datetime_prop' => 'DateTime', + 'array_nullable_prop' => 'ARRAY[object]', + 'array_and_items_nullable_prop' => 'ARRAY[object]', + 'array_items_nullable' => 'ARRAY[object]', + 'object_nullable_prop' => 'HASH[string,object]', + 'object_and_items_nullable_prop' => 'HASH[string,object]', + 'object_items_nullable' => 'HASH[string,object]' +} ); + +__PACKAGE__->attribute_map( { + 'integer_prop' => 'integer_prop', + 'number_prop' => 'number_prop', + 'boolean_prop' => 'boolean_prop', + 'string_prop' => 'string_prop', + 'date_prop' => 'date_prop', + 'datetime_prop' => 'datetime_prop', + 'array_nullable_prop' => 'array_nullable_prop', + 'array_and_items_nullable_prop' => 'array_and_items_nullable_prop', + 'array_items_nullable' => 'array_items_nullable', + 'object_nullable_prop' => 'object_nullable_prop', + 'object_and_items_nullable_prop' => 'object_and_items_nullable_prop', + 'object_items_nullable' => 'object_items_nullable' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm index 1c15114b460b..96b42362910d 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm index e11a3c80731b..00ed01553854 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm index e4ffd2f7c198..0aef6dbfe90f 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm index ce6cc165ddb7..f20810137e7a 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumDefaultValue.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumDefaultValue.pm new file mode 100644 index 000000000000..53b1d5a16208 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumDefaultValue.pm @@ -0,0 +1,177 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::OuterEnumDefaultValue; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'OuterEnumDefaultValue', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ +}); + +__PACKAGE__->openapi_types( { + +} ); + +__PACKAGE__->attribute_map( { + +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumInteger.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumInteger.pm new file mode 100644 index 000000000000..ebc6f6d0c1bb --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumInteger.pm @@ -0,0 +1,177 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::OuterEnumInteger; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'OuterEnumInteger', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ +}); + +__PACKAGE__->openapi_types( { + +} ); + +__PACKAGE__->attribute_map( { + +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumIntegerDefaultValue.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumIntegerDefaultValue.pm new file mode 100644 index 000000000000..49ff7d83eeaa --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumIntegerDefaultValue.pm @@ -0,0 +1,177 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'OuterEnumIntegerDefaultValue', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ +}); + +__PACKAGE__->openapi_types( { + +} ); + +__PACKAGE__->attribute_map( { + +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm index f0c1bcb09edd..dbb878f86b6c 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm @@ -116,13 +116,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -137,7 +144,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm index 9376c9f36ce7..96d5e1d5d9ce 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm index e1f02a3c99bb..48d438db4548 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm index 3b7cc8bba90c..d973f5e5877a 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TypeHolderDefault.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TypeHolderDefault.pm new file mode 100644 index 000000000000..147a8d9abf38 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TypeHolderDefault.pm @@ -0,0 +1,213 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::TypeHolderDefault; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep {$type=~/^(ARRAY\[|HASH\[string,)?$_(\])?$/} ('int', 'double', 'string', 'boolean') ) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'TypeHolderDefault', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'string_item' => { + datatype => 'string', + base_name => 'string_item', + description => '', + format => '', + read_only => '', + }, + 'number_item' => { + datatype => 'double', + base_name => 'number_item', + description => '', + format => '', + read_only => '', + }, + 'integer_item' => { + datatype => 'int', + base_name => 'integer_item', + description => '', + format => '', + read_only => '', + }, + 'bool_item' => { + datatype => 'boolean', + base_name => 'bool_item', + description => '', + format => '', + read_only => '', + }, + 'array_item' => { + datatype => 'ARRAY[int]', + base_name => 'array_item', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'string_item' => 'string', + 'number_item' => 'double', + 'integer_item' => 'int', + 'bool_item' => 'boolean', + 'array_item' => 'ARRAY[int]' +} ); + +__PACKAGE__->attribute_map( { + 'string_item' => 'string_item', + 'number_item' => 'number_item', + 'integer_item' => 'integer_item', + 'bool_item' => 'bool_item', + 'array_item' => 'array_item' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TypeHolderExample.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TypeHolderExample.pm new file mode 100644 index 000000000000..f3e28b05051a --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TypeHolderExample.pm @@ -0,0 +1,213 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::TypeHolderExample; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep {$type=~/^(ARRAY\[|HASH\[string,)?$_(\])?$/} ('int', 'double', 'string', 'boolean') ) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'TypeHolderExample', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'string_item' => { + datatype => 'string', + base_name => 'string_item', + description => '', + format => '', + read_only => '', + }, + 'number_item' => { + datatype => 'double', + base_name => 'number_item', + description => '', + format => '', + read_only => '', + }, + 'integer_item' => { + datatype => 'int', + base_name => 'integer_item', + description => '', + format => '', + read_only => '', + }, + 'bool_item' => { + datatype => 'boolean', + base_name => 'bool_item', + description => '', + format => '', + read_only => '', + }, + 'array_item' => { + datatype => 'ARRAY[int]', + base_name => 'array_item', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'string_item' => 'string', + 'number_item' => 'double', + 'integer_item' => 'int', + 'bool_item' => 'boolean', + 'array_item' => 'ARRAY[int]' +} ); + +__PACKAGE__->attribute_map( { + 'string_item' => 'string_item', + 'number_item' => 'number_item', + 'integer_item' => 'integer_item', + 'bool_item' => 'bool_item', + 'array_item' => 'array_item' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm index 4cac1961e661..44f7ff0f75fb 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm @@ -114,13 +114,20 @@ sub from_hash { # loop through attributes and use openapi_types to deserialize the data while ( my ($_key, $_type) = each %{$self->openapi_types} ) { my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; my @_array = (); foreach my $_element (@{$hash->{$_json_attribute}}) { push @_array, $self->_deserialize($_subclass, $_element); } $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); } else { @@ -135,7 +142,7 @@ sub from_hash { sub _deserialize { my ($self, $type, $data) = @_; $log->debugf("deserializing %s with %s",Dumper($data), $type); - + if ($type eq 'DateTime') { return DateTime->from_epoch(epoch => str2time($data)); } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/XmlItem.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/XmlItem.pm new file mode 100644 index 000000000000..d6e700b3623c --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/XmlItem.pm @@ -0,0 +1,429 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::XmlItem; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep {$type=~/^(ARRAY\[|HASH\[string,)?$_(\])?$/} ('int', 'double', 'string', 'boolean') ) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'XmlItem', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'attribute_string' => { + datatype => 'string', + base_name => 'attribute_string', + description => '', + format => '', + read_only => '', + }, + 'attribute_number' => { + datatype => 'double', + base_name => 'attribute_number', + description => '', + format => '', + read_only => '', + }, + 'attribute_integer' => { + datatype => 'int', + base_name => 'attribute_integer', + description => '', + format => '', + read_only => '', + }, + 'attribute_boolean' => { + datatype => 'boolean', + base_name => 'attribute_boolean', + description => '', + format => '', + read_only => '', + }, + 'wrapped_array' => { + datatype => 'ARRAY[int]', + base_name => 'wrapped_array', + description => '', + format => '', + read_only => '', + }, + 'name_string' => { + datatype => 'string', + base_name => 'name_string', + description => '', + format => '', + read_only => '', + }, + 'name_number' => { + datatype => 'double', + base_name => 'name_number', + description => '', + format => '', + read_only => '', + }, + 'name_integer' => { + datatype => 'int', + base_name => 'name_integer', + description => '', + format => '', + read_only => '', + }, + 'name_boolean' => { + datatype => 'boolean', + base_name => 'name_boolean', + description => '', + format => '', + read_only => '', + }, + 'name_array' => { + datatype => 'ARRAY[int]', + base_name => 'name_array', + description => '', + format => '', + read_only => '', + }, + 'name_wrapped_array' => { + datatype => 'ARRAY[int]', + base_name => 'name_wrapped_array', + description => '', + format => '', + read_only => '', + }, + 'prefix_string' => { + datatype => 'string', + base_name => 'prefix_string', + description => '', + format => '', + read_only => '', + }, + 'prefix_number' => { + datatype => 'double', + base_name => 'prefix_number', + description => '', + format => '', + read_only => '', + }, + 'prefix_integer' => { + datatype => 'int', + base_name => 'prefix_integer', + description => '', + format => '', + read_only => '', + }, + 'prefix_boolean' => { + datatype => 'boolean', + base_name => 'prefix_boolean', + description => '', + format => '', + read_only => '', + }, + 'prefix_array' => { + datatype => 'ARRAY[int]', + base_name => 'prefix_array', + description => '', + format => '', + read_only => '', + }, + 'prefix_wrapped_array' => { + datatype => 'ARRAY[int]', + base_name => 'prefix_wrapped_array', + description => '', + format => '', + read_only => '', + }, + 'namespace_string' => { + datatype => 'string', + base_name => 'namespace_string', + description => '', + format => '', + read_only => '', + }, + 'namespace_number' => { + datatype => 'double', + base_name => 'namespace_number', + description => '', + format => '', + read_only => '', + }, + 'namespace_integer' => { + datatype => 'int', + base_name => 'namespace_integer', + description => '', + format => '', + read_only => '', + }, + 'namespace_boolean' => { + datatype => 'boolean', + base_name => 'namespace_boolean', + description => '', + format => '', + read_only => '', + }, + 'namespace_array' => { + datatype => 'ARRAY[int]', + base_name => 'namespace_array', + description => '', + format => '', + read_only => '', + }, + 'namespace_wrapped_array' => { + datatype => 'ARRAY[int]', + base_name => 'namespace_wrapped_array', + description => '', + format => '', + read_only => '', + }, + 'prefix_ns_string' => { + datatype => 'string', + base_name => 'prefix_ns_string', + description => '', + format => '', + read_only => '', + }, + 'prefix_ns_number' => { + datatype => 'double', + base_name => 'prefix_ns_number', + description => '', + format => '', + read_only => '', + }, + 'prefix_ns_integer' => { + datatype => 'int', + base_name => 'prefix_ns_integer', + description => '', + format => '', + read_only => '', + }, + 'prefix_ns_boolean' => { + datatype => 'boolean', + base_name => 'prefix_ns_boolean', + description => '', + format => '', + read_only => '', + }, + 'prefix_ns_array' => { + datatype => 'ARRAY[int]', + base_name => 'prefix_ns_array', + description => '', + format => '', + read_only => '', + }, + 'prefix_ns_wrapped_array' => { + datatype => 'ARRAY[int]', + base_name => 'prefix_ns_wrapped_array', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'attribute_string' => 'string', + 'attribute_number' => 'double', + 'attribute_integer' => 'int', + 'attribute_boolean' => 'boolean', + 'wrapped_array' => 'ARRAY[int]', + 'name_string' => 'string', + 'name_number' => 'double', + 'name_integer' => 'int', + 'name_boolean' => 'boolean', + 'name_array' => 'ARRAY[int]', + 'name_wrapped_array' => 'ARRAY[int]', + 'prefix_string' => 'string', + 'prefix_number' => 'double', + 'prefix_integer' => 'int', + 'prefix_boolean' => 'boolean', + 'prefix_array' => 'ARRAY[int]', + 'prefix_wrapped_array' => 'ARRAY[int]', + 'namespace_string' => 'string', + 'namespace_number' => 'double', + 'namespace_integer' => 'int', + 'namespace_boolean' => 'boolean', + 'namespace_array' => 'ARRAY[int]', + 'namespace_wrapped_array' => 'ARRAY[int]', + 'prefix_ns_string' => 'string', + 'prefix_ns_number' => 'double', + 'prefix_ns_integer' => 'int', + 'prefix_ns_boolean' => 'boolean', + 'prefix_ns_array' => 'ARRAY[int]', + 'prefix_ns_wrapped_array' => 'ARRAY[int]' +} ); + +__PACKAGE__->attribute_map( { + 'attribute_string' => 'attribute_string', + 'attribute_number' => 'attribute_number', + 'attribute_integer' => 'attribute_integer', + 'attribute_boolean' => 'attribute_boolean', + 'wrapped_array' => 'wrapped_array', + 'name_string' => 'name_string', + 'name_number' => 'name_number', + 'name_integer' => 'name_integer', + 'name_boolean' => 'name_boolean', + 'name_array' => 'name_array', + 'name_wrapped_array' => 'name_wrapped_array', + 'prefix_string' => 'prefix_string', + 'prefix_number' => 'prefix_number', + 'prefix_integer' => 'prefix_integer', + 'prefix_boolean' => 'prefix_boolean', + 'prefix_array' => 'prefix_array', + 'prefix_wrapped_array' => 'prefix_wrapped_array', + 'namespace_string' => 'namespace_string', + 'namespace_number' => 'namespace_number', + 'namespace_integer' => 'namespace_integer', + 'namespace_boolean' => 'namespace_boolean', + 'namespace_array' => 'namespace_array', + 'namespace_wrapped_array' => 'namespace_wrapped_array', + 'prefix_ns_string' => 'prefix_ns_string', + 'prefix_ns_number' => 'prefix_ns_number', + 'prefix_ns_integer' => 'prefix_ns_integer', + 'prefix_ns_boolean' => 'prefix_ns_boolean', + 'prefix_ns_array' => 'prefix_ns_array', + 'prefix_ns_wrapped_array' => 'prefix_ns_wrapped_array' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/PetApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/PetApi.pm index 070ab1bde33b..032ecb4b861f 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/PetApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/PetApi.pm @@ -53,10 +53,10 @@ sub new { # # Add a new pet to the store # -# @param Pet $body Pet object that needs to be added to the store (required) +# @param Pet $pet Pet object that needs to be added to the store (required) { my $params = { - 'body' => { + 'pet' => { data_type => 'Pet', description => 'Pet object that needs to be added to the store', required => '1', @@ -73,9 +73,9 @@ 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"); + # verify the required parameter 'pet' is set + unless (exists $args{'pet'}) { + croak("Missing the required parameter 'pet' when calling add_pet"); } # parse inputs @@ -95,8 +95,8 @@ sub add_pet { my $_body_data; # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; + if ( exists $args{'pet'}) { + $_body_data = $args{'pet'}; } # authentication setting, if any @@ -385,10 +385,10 @@ sub get_pet_by_id { # # Update an existing pet # -# @param Pet $body Pet object that needs to be added to the store (required) +# @param Pet $pet Pet object that needs to be added to the store (required) { my $params = { - 'body' => { + 'pet' => { data_type => 'Pet', description => 'Pet object that needs to be added to the store', required => '1', @@ -405,9 +405,9 @@ sub get_pet_by_id { 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"); + # verify the required parameter 'pet' is set + unless (exists $args{'pet'}) { + croak("Missing the required parameter 'pet' when calling update_pet"); } # parse inputs @@ -427,8 +427,8 @@ sub update_pet { my $_body_data; # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; + if ( exists $args{'pet'}) { + $_body_data = $args{'pet'}; } # authentication setting, if any diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/StoreApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/StoreApi.pm index 2d730e28e559..1a564a75f407 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/StoreApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/StoreApi.pm @@ -232,10 +232,10 @@ sub get_order_by_id { # # Place an order for a pet # -# @param Order $body order placed for purchasing the pet (required) +# @param Order $order order placed for purchasing the pet (required) { my $params = { - 'body' => { + 'order' => { data_type => 'Order', description => 'order placed for purchasing the pet', required => '1', @@ -252,9 +252,9 @@ 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"); + # verify the required parameter 'order' is set + unless (exists $args{'order'}) { + croak("Missing the required parameter 'order' when calling place_order"); } # parse inputs @@ -270,12 +270,12 @@ sub place_order { if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); my $_body_data; # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; + if ( exists $args{'order'}) { + $_body_data = $args{'order'}; } # authentication setting, if any diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/UserApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/UserApi.pm index e02106644ca6..8f93e5002ce1 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/UserApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/UserApi.pm @@ -53,10 +53,10 @@ sub new { # # Create user # -# @param User $body Created user object (required) +# @param User $user Created user object (required) { my $params = { - 'body' => { + 'user' => { data_type => 'User', description => 'Created user object', required => '1', @@ -73,9 +73,9 @@ 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"); + # verify the required parameter 'user' is set + unless (exists $args{'user'}) { + croak("Missing the required parameter 'user' when calling create_user"); } # parse inputs @@ -91,12 +91,12 @@ sub create_user { if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); my $_body_data; # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; + if ( exists $args{'user'}) { + $_body_data = $args{'user'}; } # authentication setting, if any @@ -114,10 +114,10 @@ sub create_user { # # Creates list of users with given input array # -# @param ARRAY[User] $body List of user object (required) +# @param ARRAY[User] $user List of user object (required) { my $params = { - 'body' => { + 'user' => { data_type => 'ARRAY[User]', description => 'List of user object', required => '1', @@ -134,9 +134,9 @@ 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"); + # verify the required parameter 'user' is set + unless (exists $args{'user'}) { + croak("Missing the required parameter 'user' when calling create_users_with_array_input"); } # parse inputs @@ -152,12 +152,12 @@ sub create_users_with_array_input { if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); my $_body_data; # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; + if ( exists $args{'user'}) { + $_body_data = $args{'user'}; } # authentication setting, if any @@ -175,10 +175,10 @@ sub create_users_with_array_input { # # Creates list of users with given input array # -# @param ARRAY[User] $body List of user object (required) +# @param ARRAY[User] $user List of user object (required) { my $params = { - 'body' => { + 'user' => { data_type => 'ARRAY[User]', description => 'List of user object', required => '1', @@ -195,9 +195,9 @@ 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"); + # verify the required parameter 'user' is set + unless (exists $args{'user'}) { + croak("Missing the required parameter 'user' when calling create_users_with_list_input"); } # parse inputs @@ -213,12 +213,12 @@ sub create_users_with_list_input { if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); my $_body_data; # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; + if ( exists $args{'user'}) { + $_body_data = $args{'user'}; } # authentication setting, if any @@ -493,7 +493,7 @@ sub logout_user { # Updated user # # @param string $username name that need to be deleted (required) -# @param User $body Updated user object (required) +# @param User $user Updated user object (required) { my $params = { 'username' => { @@ -501,7 +501,7 @@ sub logout_user { description => 'name that need to be deleted', required => '1', }, - 'body' => { + 'user' => { data_type => 'User', description => 'Updated user object', required => '1', @@ -523,9 +523,9 @@ 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"); + # verify the required parameter 'user' is set + unless (exists $args{'user'}) { + croak("Missing the required parameter 'user' when calling update_user"); } # parse inputs @@ -541,7 +541,7 @@ sub update_user { if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); # path params if ( exists $args{'username'}) { @@ -552,8 +552,8 @@ sub update_user { my $_body_data; # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; + if ( exists $args{'user'}) { + $_body_data = $args{'user'}; } # authentication setting, if any diff --git a/samples/client/petstore/perl/t/AdditionalPropertiesAnyTypeTest.t b/samples/client/petstore/perl/t/AdditionalPropertiesAnyTypeTest.t new file mode 100644 index 000000000000..fd0e0a47e66c --- /dev/null +++ b/samples/client/petstore/perl/t/AdditionalPropertiesAnyTypeTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::AdditionalPropertiesAnyType'); + +my $instance = WWW::OpenAPIClient::Object::AdditionalPropertiesAnyType->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::AdditionalPropertiesAnyType'); + diff --git a/samples/client/petstore/perl/t/AdditionalPropertiesArrayTest.t b/samples/client/petstore/perl/t/AdditionalPropertiesArrayTest.t new file mode 100644 index 000000000000..406f44bf6afc --- /dev/null +++ b/samples/client/petstore/perl/t/AdditionalPropertiesArrayTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::AdditionalPropertiesArray'); + +my $instance = WWW::OpenAPIClient::Object::AdditionalPropertiesArray->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::AdditionalPropertiesArray'); + diff --git a/samples/client/petstore/perl/t/AdditionalPropertiesBooleanTest.t b/samples/client/petstore/perl/t/AdditionalPropertiesBooleanTest.t new file mode 100644 index 000000000000..4bd9f751cbc0 --- /dev/null +++ b/samples/client/petstore/perl/t/AdditionalPropertiesBooleanTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::AdditionalPropertiesBoolean'); + +my $instance = WWW::OpenAPIClient::Object::AdditionalPropertiesBoolean->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::AdditionalPropertiesBoolean'); + diff --git a/samples/client/petstore/perl/t/AdditionalPropertiesIntegerTest.t b/samples/client/petstore/perl/t/AdditionalPropertiesIntegerTest.t new file mode 100644 index 000000000000..3b577613f8dc --- /dev/null +++ b/samples/client/petstore/perl/t/AdditionalPropertiesIntegerTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::AdditionalPropertiesInteger'); + +my $instance = WWW::OpenAPIClient::Object::AdditionalPropertiesInteger->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::AdditionalPropertiesInteger'); + diff --git a/samples/client/petstore/perl/t/AdditionalPropertiesNumberTest.t b/samples/client/petstore/perl/t/AdditionalPropertiesNumberTest.t new file mode 100644 index 000000000000..39f1e67c5cdb --- /dev/null +++ b/samples/client/petstore/perl/t/AdditionalPropertiesNumberTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::AdditionalPropertiesNumber'); + +my $instance = WWW::OpenAPIClient::Object::AdditionalPropertiesNumber->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::AdditionalPropertiesNumber'); + diff --git a/samples/client/petstore/perl/t/AdditionalPropertiesObjectTest.t b/samples/client/petstore/perl/t/AdditionalPropertiesObjectTest.t new file mode 100644 index 000000000000..7747e041c87e --- /dev/null +++ b/samples/client/petstore/perl/t/AdditionalPropertiesObjectTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::AdditionalPropertiesObject'); + +my $instance = WWW::OpenAPIClient::Object::AdditionalPropertiesObject->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::AdditionalPropertiesObject'); + diff --git a/samples/client/petstore/perl/t/AdditionalPropertiesStringTest.t b/samples/client/petstore/perl/t/AdditionalPropertiesStringTest.t new file mode 100644 index 000000000000..aba320141d46 --- /dev/null +++ b/samples/client/petstore/perl/t/AdditionalPropertiesStringTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::AdditionalPropertiesString'); + +my $instance = WWW::OpenAPIClient::Object::AdditionalPropertiesString->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::AdditionalPropertiesString'); + diff --git a/samples/client/petstore/perl/t/HealthCheckResultTest.t b/samples/client/petstore/perl/t/HealthCheckResultTest.t new file mode 100644 index 000000000000..f4309db10dd8 --- /dev/null +++ b/samples/client/petstore/perl/t/HealthCheckResultTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::HealthCheckResult'); + +my $instance = WWW::OpenAPIClient::Object::HealthCheckResult->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::HealthCheckResult'); + diff --git a/samples/client/petstore/perl/t/NullableClassTest.t b/samples/client/petstore/perl/t/NullableClassTest.t new file mode 100644 index 000000000000..20709824493a --- /dev/null +++ b/samples/client/petstore/perl/t/NullableClassTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::NullableClass'); + +my $instance = WWW::OpenAPIClient::Object::NullableClass->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::NullableClass'); + diff --git a/samples/client/petstore/perl/t/OuterEnumDefaultValueTest.t b/samples/client/petstore/perl/t/OuterEnumDefaultValueTest.t new file mode 100644 index 000000000000..860c5dcbeead --- /dev/null +++ b/samples/client/petstore/perl/t/OuterEnumDefaultValueTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::OuterEnumDefaultValue'); + +my $instance = WWW::OpenAPIClient::Object::OuterEnumDefaultValue->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::OuterEnumDefaultValue'); + diff --git a/samples/client/petstore/perl/t/OuterEnumIntegerDefaultValueTest.t b/samples/client/petstore/perl/t/OuterEnumIntegerDefaultValueTest.t new file mode 100644 index 000000000000..54ff32ad6fef --- /dev/null +++ b/samples/client/petstore/perl/t/OuterEnumIntegerDefaultValueTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue'); + +my $instance = WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue'); + diff --git a/samples/client/petstore/perl/t/OuterEnumIntegerTest.t b/samples/client/petstore/perl/t/OuterEnumIntegerTest.t new file mode 100644 index 000000000000..5e2be8cfef4e --- /dev/null +++ b/samples/client/petstore/perl/t/OuterEnumIntegerTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::OuterEnumInteger'); + +my $instance = WWW::OpenAPIClient::Object::OuterEnumInteger->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::OuterEnumInteger'); + diff --git a/samples/client/petstore/perl/t/TypeHolderDefaultTest.t b/samples/client/petstore/perl/t/TypeHolderDefaultTest.t new file mode 100644 index 000000000000..b1f70a2fe4ef --- /dev/null +++ b/samples/client/petstore/perl/t/TypeHolderDefaultTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::TypeHolderDefault'); + +my $instance = WWW::OpenAPIClient::Object::TypeHolderDefault->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::TypeHolderDefault'); + diff --git a/samples/client/petstore/perl/t/TypeHolderExampleTest.t b/samples/client/petstore/perl/t/TypeHolderExampleTest.t new file mode 100644 index 000000000000..4daf559c3e5f --- /dev/null +++ b/samples/client/petstore/perl/t/TypeHolderExampleTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::TypeHolderExample'); + +my $instance = WWW::OpenAPIClient::Object::TypeHolderExample->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::TypeHolderExample'); + diff --git a/samples/client/petstore/perl/t/XmlItemTest.t b/samples/client/petstore/perl/t/XmlItemTest.t new file mode 100644 index 000000000000..f60e4865f277 --- /dev/null +++ b/samples/client/petstore/perl/t/XmlItemTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::XmlItem'); + +my $instance = WWW::OpenAPIClient::Object::XmlItem->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::XmlItem'); +