forked from loafle/openapi-generator-original
parent
256b27912b
commit
659e21a4bf
@ -1,6 +1,6 @@
|
|||||||
generatorName: perl
|
generatorName: perl
|
||||||
outputDir: samples/client/petstore/perl
|
outputDir: samples/client/petstore/perl
|
||||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/perl/petstore-with-fake-endpoints-models-for-testing.yaml
|
||||||
templateDir: modules/openapi-generator/src/main/resources/perl
|
templateDir: modules/openapi-generator/src/main/resources/perl
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
hideGenerationTimestamp: "true"
|
hideGenerationTimestamp: "true"
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -4,6 +4,7 @@ README.md
|
|||||||
bin/autodoc
|
bin/autodoc
|
||||||
cpanfile
|
cpanfile
|
||||||
docs/AdditionalPropertiesClass.md
|
docs/AdditionalPropertiesClass.md
|
||||||
|
docs/Adult.md
|
||||||
docs/AllOfWithSingleRef.md
|
docs/AllOfWithSingleRef.md
|
||||||
docs/Animal.md
|
docs/Animal.md
|
||||||
docs/AnotherFakeApi.md
|
docs/AnotherFakeApi.md
|
||||||
@ -14,6 +15,7 @@ docs/ArrayTest.md
|
|||||||
docs/Capitalization.md
|
docs/Capitalization.md
|
||||||
docs/Cat.md
|
docs/Cat.md
|
||||||
docs/Category.md
|
docs/Category.md
|
||||||
|
docs/Child.md
|
||||||
docs/ChildWithNullable.md
|
docs/ChildWithNullable.md
|
||||||
docs/ClassModel.md
|
docs/ClassModel.md
|
||||||
docs/Client.md
|
docs/Client.md
|
||||||
@ -33,6 +35,7 @@ docs/FooGetDefaultResponse.md
|
|||||||
docs/FormatTest.md
|
docs/FormatTest.md
|
||||||
docs/HasOnlyReadOnly.md
|
docs/HasOnlyReadOnly.md
|
||||||
docs/HealthCheckResult.md
|
docs/HealthCheckResult.md
|
||||||
|
docs/Human.md
|
||||||
docs/List.md
|
docs/List.md
|
||||||
docs/MapTest.md
|
docs/MapTest.md
|
||||||
docs/MixedPropertiesAndAdditionalPropertiesClass.md
|
docs/MixedPropertiesAndAdditionalPropertiesClass.md
|
||||||
@ -50,6 +53,7 @@ docs/OuterEnumInteger.md
|
|||||||
docs/OuterEnumIntegerDefaultValue.md
|
docs/OuterEnumIntegerDefaultValue.md
|
||||||
docs/OuterObjectWithEnumProperty.md
|
docs/OuterObjectWithEnumProperty.md
|
||||||
docs/ParentWithNullable.md
|
docs/ParentWithNullable.md
|
||||||
|
docs/Person.md
|
||||||
docs/Pet.md
|
docs/Pet.md
|
||||||
docs/PetApi.md
|
docs/PetApi.md
|
||||||
docs/ReadOnlyFirst.md
|
docs/ReadOnlyFirst.md
|
||||||
@ -69,6 +73,7 @@ lib/WWW/OpenAPIClient/DefaultApi.pm
|
|||||||
lib/WWW/OpenAPIClient/FakeApi.pm
|
lib/WWW/OpenAPIClient/FakeApi.pm
|
||||||
lib/WWW/OpenAPIClient/FakeClassnameTags123Api.pm
|
lib/WWW/OpenAPIClient/FakeClassnameTags123Api.pm
|
||||||
lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm
|
lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm
|
||||||
|
lib/WWW/OpenAPIClient/Object/Adult.pm
|
||||||
lib/WWW/OpenAPIClient/Object/AllOfWithSingleRef.pm
|
lib/WWW/OpenAPIClient/Object/AllOfWithSingleRef.pm
|
||||||
lib/WWW/OpenAPIClient/Object/Animal.pm
|
lib/WWW/OpenAPIClient/Object/Animal.pm
|
||||||
lib/WWW/OpenAPIClient/Object/ApiResponse.pm
|
lib/WWW/OpenAPIClient/Object/ApiResponse.pm
|
||||||
@ -78,6 +83,7 @@ lib/WWW/OpenAPIClient/Object/ArrayTest.pm
|
|||||||
lib/WWW/OpenAPIClient/Object/Capitalization.pm
|
lib/WWW/OpenAPIClient/Object/Capitalization.pm
|
||||||
lib/WWW/OpenAPIClient/Object/Cat.pm
|
lib/WWW/OpenAPIClient/Object/Cat.pm
|
||||||
lib/WWW/OpenAPIClient/Object/Category.pm
|
lib/WWW/OpenAPIClient/Object/Category.pm
|
||||||
|
lib/WWW/OpenAPIClient/Object/Child.pm
|
||||||
lib/WWW/OpenAPIClient/Object/ChildWithNullable.pm
|
lib/WWW/OpenAPIClient/Object/ChildWithNullable.pm
|
||||||
lib/WWW/OpenAPIClient/Object/ClassModel.pm
|
lib/WWW/OpenAPIClient/Object/ClassModel.pm
|
||||||
lib/WWW/OpenAPIClient/Object/Client.pm
|
lib/WWW/OpenAPIClient/Object/Client.pm
|
||||||
@ -94,6 +100,7 @@ lib/WWW/OpenAPIClient/Object/FooGetDefaultResponse.pm
|
|||||||
lib/WWW/OpenAPIClient/Object/FormatTest.pm
|
lib/WWW/OpenAPIClient/Object/FormatTest.pm
|
||||||
lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm
|
lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm
|
||||||
lib/WWW/OpenAPIClient/Object/HealthCheckResult.pm
|
lib/WWW/OpenAPIClient/Object/HealthCheckResult.pm
|
||||||
|
lib/WWW/OpenAPIClient/Object/Human.pm
|
||||||
lib/WWW/OpenAPIClient/Object/List.pm
|
lib/WWW/OpenAPIClient/Object/List.pm
|
||||||
lib/WWW/OpenAPIClient/Object/MapTest.pm
|
lib/WWW/OpenAPIClient/Object/MapTest.pm
|
||||||
lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm
|
lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm
|
||||||
@ -111,6 +118,7 @@ lib/WWW/OpenAPIClient/Object/OuterEnumInteger.pm
|
|||||||
lib/WWW/OpenAPIClient/Object/OuterEnumIntegerDefaultValue.pm
|
lib/WWW/OpenAPIClient/Object/OuterEnumIntegerDefaultValue.pm
|
||||||
lib/WWW/OpenAPIClient/Object/OuterObjectWithEnumProperty.pm
|
lib/WWW/OpenAPIClient/Object/OuterObjectWithEnumProperty.pm
|
||||||
lib/WWW/OpenAPIClient/Object/ParentWithNullable.pm
|
lib/WWW/OpenAPIClient/Object/ParentWithNullable.pm
|
||||||
|
lib/WWW/OpenAPIClient/Object/Person.pm
|
||||||
lib/WWW/OpenAPIClient/Object/Pet.pm
|
lib/WWW/OpenAPIClient/Object/Pet.pm
|
||||||
lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm
|
lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm
|
||||||
lib/WWW/OpenAPIClient/Object/SingleRefType.pm
|
lib/WWW/OpenAPIClient/Object/SingleRefType.pm
|
||||||
|
@ -243,6 +243,7 @@ use WWW::OpenAPIClient::UserApi;
|
|||||||
To load the models:
|
To load the models:
|
||||||
```perl
|
```perl
|
||||||
use WWW::OpenAPIClient::Object::AdditionalPropertiesClass;
|
use WWW::OpenAPIClient::Object::AdditionalPropertiesClass;
|
||||||
|
use WWW::OpenAPIClient::Object::Adult;
|
||||||
use WWW::OpenAPIClient::Object::AllOfWithSingleRef;
|
use WWW::OpenAPIClient::Object::AllOfWithSingleRef;
|
||||||
use WWW::OpenAPIClient::Object::Animal;
|
use WWW::OpenAPIClient::Object::Animal;
|
||||||
use WWW::OpenAPIClient::Object::ApiResponse;
|
use WWW::OpenAPIClient::Object::ApiResponse;
|
||||||
@ -252,6 +253,7 @@ use WWW::OpenAPIClient::Object::ArrayTest;
|
|||||||
use WWW::OpenAPIClient::Object::Capitalization;
|
use WWW::OpenAPIClient::Object::Capitalization;
|
||||||
use WWW::OpenAPIClient::Object::Cat;
|
use WWW::OpenAPIClient::Object::Cat;
|
||||||
use WWW::OpenAPIClient::Object::Category;
|
use WWW::OpenAPIClient::Object::Category;
|
||||||
|
use WWW::OpenAPIClient::Object::Child;
|
||||||
use WWW::OpenAPIClient::Object::ChildWithNullable;
|
use WWW::OpenAPIClient::Object::ChildWithNullable;
|
||||||
use WWW::OpenAPIClient::Object::ClassModel;
|
use WWW::OpenAPIClient::Object::ClassModel;
|
||||||
use WWW::OpenAPIClient::Object::Client;
|
use WWW::OpenAPIClient::Object::Client;
|
||||||
@ -268,6 +270,7 @@ use WWW::OpenAPIClient::Object::FooGetDefaultResponse;
|
|||||||
use WWW::OpenAPIClient::Object::FormatTest;
|
use WWW::OpenAPIClient::Object::FormatTest;
|
||||||
use WWW::OpenAPIClient::Object::HasOnlyReadOnly;
|
use WWW::OpenAPIClient::Object::HasOnlyReadOnly;
|
||||||
use WWW::OpenAPIClient::Object::HealthCheckResult;
|
use WWW::OpenAPIClient::Object::HealthCheckResult;
|
||||||
|
use WWW::OpenAPIClient::Object::Human;
|
||||||
use WWW::OpenAPIClient::Object::List;
|
use WWW::OpenAPIClient::Object::List;
|
||||||
use WWW::OpenAPIClient::Object::MapTest;
|
use WWW::OpenAPIClient::Object::MapTest;
|
||||||
use WWW::OpenAPIClient::Object::MixedPropertiesAndAdditionalPropertiesClass;
|
use WWW::OpenAPIClient::Object::MixedPropertiesAndAdditionalPropertiesClass;
|
||||||
@ -285,6 +288,7 @@ use WWW::OpenAPIClient::Object::OuterEnumInteger;
|
|||||||
use WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue;
|
use WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue;
|
||||||
use WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty;
|
use WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty;
|
||||||
use WWW::OpenAPIClient::Object::ParentWithNullable;
|
use WWW::OpenAPIClient::Object::ParentWithNullable;
|
||||||
|
use WWW::OpenAPIClient::Object::Person;
|
||||||
use WWW::OpenAPIClient::Object::Pet;
|
use WWW::OpenAPIClient::Object::Pet;
|
||||||
use WWW::OpenAPIClient::Object::ReadOnlyFirst;
|
use WWW::OpenAPIClient::Object::ReadOnlyFirst;
|
||||||
use WWW::OpenAPIClient::Object::SingleRefType;
|
use WWW::OpenAPIClient::Object::SingleRefType;
|
||||||
@ -313,6 +317,7 @@ use WWW::OpenAPIClient::UserApi;
|
|||||||
|
|
||||||
# load the models
|
# load the models
|
||||||
use WWW::OpenAPIClient::Object::AdditionalPropertiesClass;
|
use WWW::OpenAPIClient::Object::AdditionalPropertiesClass;
|
||||||
|
use WWW::OpenAPIClient::Object::Adult;
|
||||||
use WWW::OpenAPIClient::Object::AllOfWithSingleRef;
|
use WWW::OpenAPIClient::Object::AllOfWithSingleRef;
|
||||||
use WWW::OpenAPIClient::Object::Animal;
|
use WWW::OpenAPIClient::Object::Animal;
|
||||||
use WWW::OpenAPIClient::Object::ApiResponse;
|
use WWW::OpenAPIClient::Object::ApiResponse;
|
||||||
@ -322,6 +327,7 @@ use WWW::OpenAPIClient::Object::ArrayTest;
|
|||||||
use WWW::OpenAPIClient::Object::Capitalization;
|
use WWW::OpenAPIClient::Object::Capitalization;
|
||||||
use WWW::OpenAPIClient::Object::Cat;
|
use WWW::OpenAPIClient::Object::Cat;
|
||||||
use WWW::OpenAPIClient::Object::Category;
|
use WWW::OpenAPIClient::Object::Category;
|
||||||
|
use WWW::OpenAPIClient::Object::Child;
|
||||||
use WWW::OpenAPIClient::Object::ChildWithNullable;
|
use WWW::OpenAPIClient::Object::ChildWithNullable;
|
||||||
use WWW::OpenAPIClient::Object::ClassModel;
|
use WWW::OpenAPIClient::Object::ClassModel;
|
||||||
use WWW::OpenAPIClient::Object::Client;
|
use WWW::OpenAPIClient::Object::Client;
|
||||||
@ -338,6 +344,7 @@ use WWW::OpenAPIClient::Object::FooGetDefaultResponse;
|
|||||||
use WWW::OpenAPIClient::Object::FormatTest;
|
use WWW::OpenAPIClient::Object::FormatTest;
|
||||||
use WWW::OpenAPIClient::Object::HasOnlyReadOnly;
|
use WWW::OpenAPIClient::Object::HasOnlyReadOnly;
|
||||||
use WWW::OpenAPIClient::Object::HealthCheckResult;
|
use WWW::OpenAPIClient::Object::HealthCheckResult;
|
||||||
|
use WWW::OpenAPIClient::Object::Human;
|
||||||
use WWW::OpenAPIClient::Object::List;
|
use WWW::OpenAPIClient::Object::List;
|
||||||
use WWW::OpenAPIClient::Object::MapTest;
|
use WWW::OpenAPIClient::Object::MapTest;
|
||||||
use WWW::OpenAPIClient::Object::MixedPropertiesAndAdditionalPropertiesClass;
|
use WWW::OpenAPIClient::Object::MixedPropertiesAndAdditionalPropertiesClass;
|
||||||
@ -355,6 +362,7 @@ use WWW::OpenAPIClient::Object::OuterEnumInteger;
|
|||||||
use WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue;
|
use WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue;
|
||||||
use WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty;
|
use WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty;
|
||||||
use WWW::OpenAPIClient::Object::ParentWithNullable;
|
use WWW::OpenAPIClient::Object::ParentWithNullable;
|
||||||
|
use WWW::OpenAPIClient::Object::Person;
|
||||||
use WWW::OpenAPIClient::Object::Pet;
|
use WWW::OpenAPIClient::Object::Pet;
|
||||||
use WWW::OpenAPIClient::Object::ReadOnlyFirst;
|
use WWW::OpenAPIClient::Object::ReadOnlyFirst;
|
||||||
use WWW::OpenAPIClient::Object::SingleRefType;
|
use WWW::OpenAPIClient::Object::SingleRefType;
|
||||||
@ -437,6 +445,7 @@ Class | Method | HTTP request | Description
|
|||||||
|
|
||||||
# DOCUMENTATION FOR MODELS
|
# DOCUMENTATION FOR MODELS
|
||||||
- [WWW::OpenAPIClient::Object::AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
- [WWW::OpenAPIClient::Object::AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
|
||||||
|
- [WWW::OpenAPIClient::Object::Adult](docs/Adult.md)
|
||||||
- [WWW::OpenAPIClient::Object::AllOfWithSingleRef](docs/AllOfWithSingleRef.md)
|
- [WWW::OpenAPIClient::Object::AllOfWithSingleRef](docs/AllOfWithSingleRef.md)
|
||||||
- [WWW::OpenAPIClient::Object::Animal](docs/Animal.md)
|
- [WWW::OpenAPIClient::Object::Animal](docs/Animal.md)
|
||||||
- [WWW::OpenAPIClient::Object::ApiResponse](docs/ApiResponse.md)
|
- [WWW::OpenAPIClient::Object::ApiResponse](docs/ApiResponse.md)
|
||||||
@ -446,6 +455,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [WWW::OpenAPIClient::Object::Capitalization](docs/Capitalization.md)
|
- [WWW::OpenAPIClient::Object::Capitalization](docs/Capitalization.md)
|
||||||
- [WWW::OpenAPIClient::Object::Cat](docs/Cat.md)
|
- [WWW::OpenAPIClient::Object::Cat](docs/Cat.md)
|
||||||
- [WWW::OpenAPIClient::Object::Category](docs/Category.md)
|
- [WWW::OpenAPIClient::Object::Category](docs/Category.md)
|
||||||
|
- [WWW::OpenAPIClient::Object::Child](docs/Child.md)
|
||||||
- [WWW::OpenAPIClient::Object::ChildWithNullable](docs/ChildWithNullable.md)
|
- [WWW::OpenAPIClient::Object::ChildWithNullable](docs/ChildWithNullable.md)
|
||||||
- [WWW::OpenAPIClient::Object::ClassModel](docs/ClassModel.md)
|
- [WWW::OpenAPIClient::Object::ClassModel](docs/ClassModel.md)
|
||||||
- [WWW::OpenAPIClient::Object::Client](docs/Client.md)
|
- [WWW::OpenAPIClient::Object::Client](docs/Client.md)
|
||||||
@ -462,6 +472,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [WWW::OpenAPIClient::Object::FormatTest](docs/FormatTest.md)
|
- [WWW::OpenAPIClient::Object::FormatTest](docs/FormatTest.md)
|
||||||
- [WWW::OpenAPIClient::Object::HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
|
- [WWW::OpenAPIClient::Object::HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
|
||||||
- [WWW::OpenAPIClient::Object::HealthCheckResult](docs/HealthCheckResult.md)
|
- [WWW::OpenAPIClient::Object::HealthCheckResult](docs/HealthCheckResult.md)
|
||||||
|
- [WWW::OpenAPIClient::Object::Human](docs/Human.md)
|
||||||
- [WWW::OpenAPIClient::Object::List](docs/List.md)
|
- [WWW::OpenAPIClient::Object::List](docs/List.md)
|
||||||
- [WWW::OpenAPIClient::Object::MapTest](docs/MapTest.md)
|
- [WWW::OpenAPIClient::Object::MapTest](docs/MapTest.md)
|
||||||
- [WWW::OpenAPIClient::Object::MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
- [WWW::OpenAPIClient::Object::MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
|
||||||
@ -479,6 +490,7 @@ Class | Method | HTTP request | Description
|
|||||||
- [WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
|
- [WWW::OpenAPIClient::Object::OuterEnumIntegerDefaultValue](docs/OuterEnumIntegerDefaultValue.md)
|
||||||
- [WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
|
- [WWW::OpenAPIClient::Object::OuterObjectWithEnumProperty](docs/OuterObjectWithEnumProperty.md)
|
||||||
- [WWW::OpenAPIClient::Object::ParentWithNullable](docs/ParentWithNullable.md)
|
- [WWW::OpenAPIClient::Object::ParentWithNullable](docs/ParentWithNullable.md)
|
||||||
|
- [WWW::OpenAPIClient::Object::Person](docs/Person.md)
|
||||||
- [WWW::OpenAPIClient::Object::Pet](docs/Pet.md)
|
- [WWW::OpenAPIClient::Object::Pet](docs/Pet.md)
|
||||||
- [WWW::OpenAPIClient::Object::ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
- [WWW::OpenAPIClient::Object::ReadOnlyFirst](docs/ReadOnlyFirst.md)
|
||||||
- [WWW::OpenAPIClient::Object::SingleRefType](docs/SingleRefType.md)
|
- [WWW::OpenAPIClient::Object::SingleRefType](docs/SingleRefType.md)
|
||||||
|
18
samples/client/petstore/perl/docs/Adult.md
Normal file
18
samples/client/petstore/perl/docs/Adult.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# WWW::OpenAPIClient::Object::Adult
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```perl
|
||||||
|
use WWW::OpenAPIClient::Object::Adult;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**duplicated_optional** | **int** | | [optional]
|
||||||
|
**duplicated_required** | **int** | |
|
||||||
|
**children** | [**ARRAY[Child]**](Child.md) | | [optional]
|
||||||
|
**adult_required** | **boolean** | | [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)
|
||||||
|
|
||||||
|
|
16
samples/client/petstore/perl/docs/Child.md
Normal file
16
samples/client/petstore/perl/docs/Child.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# WWW::OpenAPIClient::Object::Child
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```perl
|
||||||
|
use WWW::OpenAPIClient::Object::Child;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**age** | **int** | | [optional]
|
||||||
|
**first_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)
|
||||||
|
|
||||||
|
|
16
samples/client/petstore/perl/docs/Human.md
Normal file
16
samples/client/petstore/perl/docs/Human.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# WWW::OpenAPIClient::Object::Human
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```perl
|
||||||
|
use WWW::OpenAPIClient::Object::Human;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**___type** | **string** | | [optional]
|
||||||
|
**body** | **string** | |
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
20
samples/client/petstore/perl/docs/Person.md
Normal file
20
samples/client/petstore/perl/docs/Person.md
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# WWW::OpenAPIClient::Object::Person
|
||||||
|
|
||||||
|
## Load the model package
|
||||||
|
```perl
|
||||||
|
use WWW::OpenAPIClient::Object::Person;
|
||||||
|
```
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**___type** | **string** | | [optional]
|
||||||
|
**last_name** | **string** | | [optional]
|
||||||
|
**first_name** | **string** | | [optional]
|
||||||
|
**duplicated_optional** | **int** | | [optional]
|
||||||
|
**duplicated_required** | **int** | |
|
||||||
|
**person_required** | **DATE_TIME** | |
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
@ -0,0 +1,296 @@
|
|||||||
|
=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: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 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::Adult;
|
||||||
|
|
||||||
|
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 WWW::OpenAPIClient::Object::Child;
|
||||||
|
use WWW::OpenAPIClient::Object::Human;
|
||||||
|
use WWW::OpenAPIClient::Object::Person;
|
||||||
|
|
||||||
|
use base ("Class::Accessor", "Class::Data::Inheritable", "WWW::OpenAPIClient::Object::Person", "WWW::OpenAPIClient::Object::Human");
|
||||||
|
|
||||||
|
#
|
||||||
|
#A representation of an adult
|
||||||
|
#
|
||||||
|
# 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: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 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 } );
|
||||||
|
}
|
||||||
|
|
||||||
|
# initialize parent object Person
|
||||||
|
$self->WWW::OpenAPIClient::Object::Person::init(%args);
|
||||||
|
|
||||||
|
# initialize parent object Human
|
||||||
|
$self->WWW::OpenAPIClient::Object::Human::init(%args);
|
||||||
|
}
|
||||||
|
|
||||||
|
# return perl hash
|
||||||
|
sub to_hash {
|
||||||
|
my $self = shift;
|
||||||
|
my $_hash = decode_json(JSON->new->convert_blessed->encode($self));
|
||||||
|
|
||||||
|
# call Person to_hash and then combine hash
|
||||||
|
$_hash = { %$_hash, %$self->WWW::OpenAPIClient::Object::Person::to_hash };
|
||||||
|
|
||||||
|
# call Human to_hash and then combine hash
|
||||||
|
$_hash = { %$_hash, %$self->WWW::OpenAPIClient::Object::Human::to_hash };
|
||||||
|
|
||||||
|
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}) {
|
||||||
|
my $_json_attribute = $self->attribute_map->{$_key};
|
||||||
|
my $_type = $self->openapi_types->{$_key};
|
||||||
|
my $_value = $self->{$_key};
|
||||||
|
if ($_type =~ /^array\[(.+)\]$/i) { # array
|
||||||
|
my $_subclass = $1;
|
||||||
|
$_data->{$_json_attribute} = [ map { $self->_to_json_primitives($_subclass, $_) } @$_value ];
|
||||||
|
} elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash
|
||||||
|
my $_subclass = $1;
|
||||||
|
my %_hash = ();
|
||||||
|
while (my($_key, $_element) = each %{$_value}) {
|
||||||
|
$_hash{$_key} = $self->_to_json_primitives($_subclass, $_element);
|
||||||
|
}
|
||||||
|
$_data->{$_json_attribute} = \%_hash;
|
||||||
|
} elsif ( grep( /^$_type$/, ('int', 'double', 'string', 'boolean', 'DATE', 'DATE_TIME'))) {
|
||||||
|
$_data->{$_json_attribute} = $self->_to_json_primitives($_type, $_value);
|
||||||
|
} else {
|
||||||
|
$_data->{$_json_attribute} = $_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# combine parent (Person) TO_JSON
|
||||||
|
$_data = { %$_data, %$self->WWW::OpenAPIClient::Object::Person::TO_JSON };
|
||||||
|
|
||||||
|
# combine parent (Human) TO_JSON
|
||||||
|
$_data = { %$_data, %$self->WWW::OpenAPIClient::Object::Human::TO_JSON };
|
||||||
|
|
||||||
|
return $_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
# to_json non-array data
|
||||||
|
sub _to_json_primitives {
|
||||||
|
my ($self, $type, $data) = @_;
|
||||||
|
if ( grep( /^$type$/, ('int', 'double'))) {
|
||||||
|
# https://metacpan.org/pod/JSON#simple-scalars
|
||||||
|
# numify it, ensuring it will be dumped as a number
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data + 0;
|
||||||
|
} elsif ($type eq 'string') {
|
||||||
|
# https://metacpan.org/pod/JSON#simple-scalars
|
||||||
|
# stringified
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data . q();
|
||||||
|
} elsif ($type eq 'boolean') {
|
||||||
|
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
|
||||||
|
return $data ? \1 : \0;
|
||||||
|
} elsif ($type eq 'DATE') {
|
||||||
|
return undef unless defined $data;
|
||||||
|
if (ref($data) eq 'DateTime') {
|
||||||
|
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
|
||||||
|
return $data->ymd;
|
||||||
|
}
|
||||||
|
return $data .q();
|
||||||
|
} elsif ($type eq 'DATE_TIME') {
|
||||||
|
return undef unless defined $data;
|
||||||
|
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
|
||||||
|
if (ref($data) eq 'DateTime') {
|
||||||
|
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
|
||||||
|
return $data->rfc3339;
|
||||||
|
}
|
||||||
|
return $data .q();
|
||||||
|
} else { # hash (model), In this case, the TO_JSON of the $data object is executed
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# call parent (Person) from_hash
|
||||||
|
$self->WWW::OpenAPIClient::Object::Person::from_hash($hash);
|
||||||
|
|
||||||
|
# call parent (Human) from_hash
|
||||||
|
$self->WWW::OpenAPIClient::Object::Human::from_hash($hash);
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
# deserialize non-array data
|
||||||
|
sub _deserialize {
|
||||||
|
my ($self, $type, $data) = @_;
|
||||||
|
$log->debugf("deserializing %s with %s",Dumper($data), $type);
|
||||||
|
|
||||||
|
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
|
||||||
|
return DateTime->from_epoch(epoch => str2time($data));
|
||||||
|
} elsif ( grep( /^$type$/, ('int', 'double'))) {
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data + 0;
|
||||||
|
} elsif ($type eq 'string') {
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data . q();
|
||||||
|
} elsif ($type eq 'boolean') {
|
||||||
|
return !!$data;
|
||||||
|
} else { # hash(model)
|
||||||
|
my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()";
|
||||||
|
return $_instance->from_hash($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__PACKAGE__->class_documentation({description => 'A representation of an adult',
|
||||||
|
class => 'Adult',
|
||||||
|
required => [], # TODO
|
||||||
|
} );
|
||||||
|
|
||||||
|
__PACKAGE__->method_documentation({
|
||||||
|
'duplicated_optional' => {
|
||||||
|
datatype => 'int',
|
||||||
|
base_name => 'duplicated_optional',
|
||||||
|
description => '',
|
||||||
|
format => '',
|
||||||
|
read_only => '',
|
||||||
|
},
|
||||||
|
'duplicated_required' => {
|
||||||
|
datatype => 'int',
|
||||||
|
base_name => 'duplicated_required',
|
||||||
|
description => '',
|
||||||
|
format => '',
|
||||||
|
read_only => '',
|
||||||
|
},
|
||||||
|
'children' => {
|
||||||
|
datatype => 'ARRAY[Child]',
|
||||||
|
base_name => 'children',
|
||||||
|
description => '',
|
||||||
|
format => '',
|
||||||
|
read_only => '',
|
||||||
|
},
|
||||||
|
'adult_required' => {
|
||||||
|
datatype => 'boolean',
|
||||||
|
base_name => 'adult_required',
|
||||||
|
description => '',
|
||||||
|
format => '',
|
||||||
|
read_only => '',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
__PACKAGE__->openapi_types( {
|
||||||
|
'duplicated_optional' => 'int',
|
||||||
|
'duplicated_required' => 'int',
|
||||||
|
'children' => 'ARRAY[Child]',
|
||||||
|
'adult_required' => 'boolean'
|
||||||
|
} );
|
||||||
|
|
||||||
|
__PACKAGE__->attribute_map( {
|
||||||
|
'duplicated_optional' => 'duplicated_optional',
|
||||||
|
'duplicated_required' => 'duplicated_required',
|
||||||
|
'children' => 'children',
|
||||||
|
'adult_required' => 'adult_required'
|
||||||
|
} );
|
||||||
|
|
||||||
|
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
@ -0,0 +1,264 @@
|
|||||||
|
=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: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 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::Child;
|
||||||
|
|
||||||
|
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 WWW::OpenAPIClient::Object::Person;
|
||||||
|
|
||||||
|
use base ("Class::Accessor", "Class::Data::Inheritable", "WWW::OpenAPIClient::Object::Person");
|
||||||
|
|
||||||
|
#
|
||||||
|
#A representation of a child
|
||||||
|
#
|
||||||
|
# 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: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 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 } );
|
||||||
|
}
|
||||||
|
|
||||||
|
# initialize parent object Person
|
||||||
|
$self->WWW::OpenAPIClient::Object::Person::init(%args);
|
||||||
|
}
|
||||||
|
|
||||||
|
# return perl hash
|
||||||
|
sub to_hash {
|
||||||
|
my $self = shift;
|
||||||
|
my $_hash = decode_json(JSON->new->convert_blessed->encode($self));
|
||||||
|
|
||||||
|
# call Person to_hash and then combine hash
|
||||||
|
$_hash = { %$_hash, %$self->WWW::OpenAPIClient::Object::Person::to_hash };
|
||||||
|
|
||||||
|
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}) {
|
||||||
|
my $_json_attribute = $self->attribute_map->{$_key};
|
||||||
|
my $_type = $self->openapi_types->{$_key};
|
||||||
|
my $_value = $self->{$_key};
|
||||||
|
if ($_type =~ /^array\[(.+)\]$/i) { # array
|
||||||
|
my $_subclass = $1;
|
||||||
|
$_data->{$_json_attribute} = [ map { $self->_to_json_primitives($_subclass, $_) } @$_value ];
|
||||||
|
} elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash
|
||||||
|
my $_subclass = $1;
|
||||||
|
my %_hash = ();
|
||||||
|
while (my($_key, $_element) = each %{$_value}) {
|
||||||
|
$_hash{$_key} = $self->_to_json_primitives($_subclass, $_element);
|
||||||
|
}
|
||||||
|
$_data->{$_json_attribute} = \%_hash;
|
||||||
|
} elsif ( grep( /^$_type$/, ('int', 'double', 'string', 'boolean', 'DATE', 'DATE_TIME'))) {
|
||||||
|
$_data->{$_json_attribute} = $self->_to_json_primitives($_type, $_value);
|
||||||
|
} else {
|
||||||
|
$_data->{$_json_attribute} = $_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# combine parent (Person) TO_JSON
|
||||||
|
$_data = { %$_data, %$self->WWW::OpenAPIClient::Object::Person::TO_JSON };
|
||||||
|
|
||||||
|
return $_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
# to_json non-array data
|
||||||
|
sub _to_json_primitives {
|
||||||
|
my ($self, $type, $data) = @_;
|
||||||
|
if ( grep( /^$type$/, ('int', 'double'))) {
|
||||||
|
# https://metacpan.org/pod/JSON#simple-scalars
|
||||||
|
# numify it, ensuring it will be dumped as a number
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data + 0;
|
||||||
|
} elsif ($type eq 'string') {
|
||||||
|
# https://metacpan.org/pod/JSON#simple-scalars
|
||||||
|
# stringified
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data . q();
|
||||||
|
} elsif ($type eq 'boolean') {
|
||||||
|
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
|
||||||
|
return $data ? \1 : \0;
|
||||||
|
} elsif ($type eq 'DATE') {
|
||||||
|
return undef unless defined $data;
|
||||||
|
if (ref($data) eq 'DateTime') {
|
||||||
|
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
|
||||||
|
return $data->ymd;
|
||||||
|
}
|
||||||
|
return $data .q();
|
||||||
|
} elsif ($type eq 'DATE_TIME') {
|
||||||
|
return undef unless defined $data;
|
||||||
|
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
|
||||||
|
if (ref($data) eq 'DateTime') {
|
||||||
|
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
|
||||||
|
return $data->rfc3339;
|
||||||
|
}
|
||||||
|
return $data .q();
|
||||||
|
} else { # hash (model), In this case, the TO_JSON of the $data object is executed
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# call parent (Person) from_hash
|
||||||
|
$self->WWW::OpenAPIClient::Object::Person::from_hash($hash);
|
||||||
|
|
||||||
|
return $self;
|
||||||
|
}
|
||||||
|
|
||||||
|
# deserialize non-array data
|
||||||
|
sub _deserialize {
|
||||||
|
my ($self, $type, $data) = @_;
|
||||||
|
$log->debugf("deserializing %s with %s",Dumper($data), $type);
|
||||||
|
|
||||||
|
if (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
|
||||||
|
return DateTime->from_epoch(epoch => str2time($data));
|
||||||
|
} elsif ( grep( /^$type$/, ('int', 'double'))) {
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data + 0;
|
||||||
|
} elsif ($type eq 'string') {
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data . q();
|
||||||
|
} elsif ($type eq 'boolean') {
|
||||||
|
return !!$data;
|
||||||
|
} else { # hash(model)
|
||||||
|
my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()";
|
||||||
|
return $_instance->from_hash($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__PACKAGE__->class_documentation({description => 'A representation of a child',
|
||||||
|
class => 'Child',
|
||||||
|
required => [], # TODO
|
||||||
|
} );
|
||||||
|
|
||||||
|
__PACKAGE__->method_documentation({
|
||||||
|
'age' => {
|
||||||
|
datatype => 'int',
|
||||||
|
base_name => 'age',
|
||||||
|
description => '',
|
||||||
|
format => '',
|
||||||
|
read_only => '',
|
||||||
|
},
|
||||||
|
'first_name' => {
|
||||||
|
datatype => 'string',
|
||||||
|
base_name => 'firstName',
|
||||||
|
description => '',
|
||||||
|
format => '',
|
||||||
|
read_only => '',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
__PACKAGE__->openapi_types( {
|
||||||
|
'age' => 'int',
|
||||||
|
'first_name' => 'string'
|
||||||
|
} );
|
||||||
|
|
||||||
|
__PACKAGE__->attribute_map( {
|
||||||
|
'age' => 'age',
|
||||||
|
'first_name' => 'firstName'
|
||||||
|
} );
|
||||||
|
|
||||||
|
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
@ -0,0 +1,251 @@
|
|||||||
|
=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: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 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::Human;
|
||||||
|
|
||||||
|
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: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 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}) {
|
||||||
|
my $_json_attribute = $self->attribute_map->{$_key};
|
||||||
|
my $_type = $self->openapi_types->{$_key};
|
||||||
|
my $_value = $self->{$_key};
|
||||||
|
if ($_type =~ /^array\[(.+)\]$/i) { # array
|
||||||
|
my $_subclass = $1;
|
||||||
|
$_data->{$_json_attribute} = [ map { $self->_to_json_primitives($_subclass, $_) } @$_value ];
|
||||||
|
} elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash
|
||||||
|
my $_subclass = $1;
|
||||||
|
my %_hash = ();
|
||||||
|
while (my($_key, $_element) = each %{$_value}) {
|
||||||
|
$_hash{$_key} = $self->_to_json_primitives($_subclass, $_element);
|
||||||
|
}
|
||||||
|
$_data->{$_json_attribute} = \%_hash;
|
||||||
|
} elsif ( grep( /^$_type$/, ('int', 'double', 'string', 'boolean', 'DATE', 'DATE_TIME'))) {
|
||||||
|
$_data->{$_json_attribute} = $self->_to_json_primitives($_type, $_value);
|
||||||
|
} else {
|
||||||
|
$_data->{$_json_attribute} = $_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
# to_json non-array data
|
||||||
|
sub _to_json_primitives {
|
||||||
|
my ($self, $type, $data) = @_;
|
||||||
|
if ( grep( /^$type$/, ('int', 'double'))) {
|
||||||
|
# https://metacpan.org/pod/JSON#simple-scalars
|
||||||
|
# numify it, ensuring it will be dumped as a number
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data + 0;
|
||||||
|
} elsif ($type eq 'string') {
|
||||||
|
# https://metacpan.org/pod/JSON#simple-scalars
|
||||||
|
# stringified
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data . q();
|
||||||
|
} elsif ($type eq 'boolean') {
|
||||||
|
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
|
||||||
|
return $data ? \1 : \0;
|
||||||
|
} elsif ($type eq 'DATE') {
|
||||||
|
return undef unless defined $data;
|
||||||
|
if (ref($data) eq 'DateTime') {
|
||||||
|
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
|
||||||
|
return $data->ymd;
|
||||||
|
}
|
||||||
|
return $data .q();
|
||||||
|
} elsif ($type eq 'DATE_TIME') {
|
||||||
|
return undef unless defined $data;
|
||||||
|
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
|
||||||
|
if (ref($data) eq 'DateTime') {
|
||||||
|
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
|
||||||
|
return $data->rfc3339;
|
||||||
|
}
|
||||||
|
return $data .q();
|
||||||
|
} else { # hash (model), In this case, the TO_JSON of the $data object is executed
|
||||||
|
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 (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
|
||||||
|
return DateTime->from_epoch(epoch => str2time($data));
|
||||||
|
} elsif ( grep( /^$type$/, ('int', 'double'))) {
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data + 0;
|
||||||
|
} elsif ($type eq 'string') {
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data . q();
|
||||||
|
} elsif ($type eq 'boolean') {
|
||||||
|
return !!$data;
|
||||||
|
} else { # hash(model)
|
||||||
|
my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()";
|
||||||
|
return $_instance->from_hash($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__PACKAGE__->class_documentation({description => '',
|
||||||
|
class => 'Human',
|
||||||
|
required => [], # TODO
|
||||||
|
} );
|
||||||
|
|
||||||
|
__PACKAGE__->method_documentation({
|
||||||
|
'___type' => {
|
||||||
|
datatype => 'string',
|
||||||
|
base_name => '$_type',
|
||||||
|
description => '',
|
||||||
|
format => '',
|
||||||
|
read_only => '',
|
||||||
|
},
|
||||||
|
'body' => {
|
||||||
|
datatype => 'string',
|
||||||
|
base_name => 'body',
|
||||||
|
description => '',
|
||||||
|
format => '',
|
||||||
|
read_only => '',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
__PACKAGE__->openapi_types( {
|
||||||
|
'___type' => 'string',
|
||||||
|
'body' => 'string'
|
||||||
|
} );
|
||||||
|
|
||||||
|
__PACKAGE__->attribute_map( {
|
||||||
|
'___type' => '$_type',
|
||||||
|
'body' => 'body'
|
||||||
|
} );
|
||||||
|
|
||||||
|
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
@ -0,0 +1,287 @@
|
|||||||
|
=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: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 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::Person;
|
||||||
|
|
||||||
|
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: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 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}) {
|
||||||
|
my $_json_attribute = $self->attribute_map->{$_key};
|
||||||
|
my $_type = $self->openapi_types->{$_key};
|
||||||
|
my $_value = $self->{$_key};
|
||||||
|
if ($_type =~ /^array\[(.+)\]$/i) { # array
|
||||||
|
my $_subclass = $1;
|
||||||
|
$_data->{$_json_attribute} = [ map { $self->_to_json_primitives($_subclass, $_) } @$_value ];
|
||||||
|
} elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash
|
||||||
|
my $_subclass = $1;
|
||||||
|
my %_hash = ();
|
||||||
|
while (my($_key, $_element) = each %{$_value}) {
|
||||||
|
$_hash{$_key} = $self->_to_json_primitives($_subclass, $_element);
|
||||||
|
}
|
||||||
|
$_data->{$_json_attribute} = \%_hash;
|
||||||
|
} elsif ( grep( /^$_type$/, ('int', 'double', 'string', 'boolean', 'DATE', 'DATE_TIME'))) {
|
||||||
|
$_data->{$_json_attribute} = $self->_to_json_primitives($_type, $_value);
|
||||||
|
} else {
|
||||||
|
$_data->{$_json_attribute} = $_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
# to_json non-array data
|
||||||
|
sub _to_json_primitives {
|
||||||
|
my ($self, $type, $data) = @_;
|
||||||
|
if ( grep( /^$type$/, ('int', 'double'))) {
|
||||||
|
# https://metacpan.org/pod/JSON#simple-scalars
|
||||||
|
# numify it, ensuring it will be dumped as a number
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data + 0;
|
||||||
|
} elsif ($type eq 'string') {
|
||||||
|
# https://metacpan.org/pod/JSON#simple-scalars
|
||||||
|
# stringified
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data . q();
|
||||||
|
} elsif ($type eq 'boolean') {
|
||||||
|
# https://metacpan.org/pod/JSON#JSON::true,-JSON::false,-JSON::null
|
||||||
|
return $data ? \1 : \0;
|
||||||
|
} elsif ($type eq 'DATE') {
|
||||||
|
return undef unless defined $data;
|
||||||
|
if (ref($data) eq 'DateTime') {
|
||||||
|
# https://metacpan.org/pod/DateTime#$dt-%3Eymd($optional_separator),-$dt-%3Emdy(...),-$dt-%3Edmy(...)
|
||||||
|
return $data->ymd;
|
||||||
|
}
|
||||||
|
return $data .q();
|
||||||
|
} elsif ($type eq 'DATE_TIME') {
|
||||||
|
return undef unless defined $data;
|
||||||
|
# the date-time notation as defined by RFC 3339, section 5.6, for example, 2017-07-21T17:32:28Z
|
||||||
|
if (ref($data) eq 'DateTime') {
|
||||||
|
# https://metacpan.org/pod/DateTime#$dt-%3Erfc3339
|
||||||
|
return $data->rfc3339;
|
||||||
|
}
|
||||||
|
return $data .q();
|
||||||
|
} else { # hash (model), In this case, the TO_JSON of the $data object is executed
|
||||||
|
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 (grep( /^$type$/ , ('DATE_TIME', 'DATE'))) {
|
||||||
|
return DateTime->from_epoch(epoch => str2time($data));
|
||||||
|
} elsif ( grep( /^$type$/, ('int', 'double'))) {
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data + 0;
|
||||||
|
} elsif ($type eq 'string') {
|
||||||
|
return undef unless defined $data;
|
||||||
|
return $data . q();
|
||||||
|
} elsif ($type eq 'boolean') {
|
||||||
|
return !!$data;
|
||||||
|
} else { # hash(model)
|
||||||
|
my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()";
|
||||||
|
return $_instance->from_hash($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
__PACKAGE__->class_documentation({description => '',
|
||||||
|
class => 'Person',
|
||||||
|
required => [], # TODO
|
||||||
|
} );
|
||||||
|
|
||||||
|
__PACKAGE__->method_documentation({
|
||||||
|
'___type' => {
|
||||||
|
datatype => 'string',
|
||||||
|
base_name => '$_type',
|
||||||
|
description => '',
|
||||||
|
format => '',
|
||||||
|
read_only => '',
|
||||||
|
},
|
||||||
|
'last_name' => {
|
||||||
|
datatype => 'string',
|
||||||
|
base_name => 'lastName',
|
||||||
|
description => '',
|
||||||
|
format => '',
|
||||||
|
read_only => '',
|
||||||
|
},
|
||||||
|
'first_name' => {
|
||||||
|
datatype => 'string',
|
||||||
|
base_name => 'firstName',
|
||||||
|
description => '',
|
||||||
|
format => '',
|
||||||
|
read_only => '',
|
||||||
|
},
|
||||||
|
'duplicated_optional' => {
|
||||||
|
datatype => 'int',
|
||||||
|
base_name => 'duplicated_optional',
|
||||||
|
description => '',
|
||||||
|
format => '',
|
||||||
|
read_only => '',
|
||||||
|
},
|
||||||
|
'duplicated_required' => {
|
||||||
|
datatype => 'int',
|
||||||
|
base_name => 'duplicated_required',
|
||||||
|
description => '',
|
||||||
|
format => '',
|
||||||
|
read_only => '',
|
||||||
|
},
|
||||||
|
'person_required' => {
|
||||||
|
datatype => 'DATE_TIME',
|
||||||
|
base_name => 'person_required',
|
||||||
|
description => '',
|
||||||
|
format => '',
|
||||||
|
read_only => '',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
__PACKAGE__->openapi_types( {
|
||||||
|
'___type' => 'string',
|
||||||
|
'last_name' => 'string',
|
||||||
|
'first_name' => 'string',
|
||||||
|
'duplicated_optional' => 'int',
|
||||||
|
'duplicated_required' => 'int',
|
||||||
|
'person_required' => 'DATE_TIME'
|
||||||
|
} );
|
||||||
|
|
||||||
|
__PACKAGE__->attribute_map( {
|
||||||
|
'___type' => '$_type',
|
||||||
|
'last_name' => 'lastName',
|
||||||
|
'first_name' => 'firstName',
|
||||||
|
'duplicated_optional' => 'duplicated_optional',
|
||||||
|
'duplicated_required' => 'duplicated_required',
|
||||||
|
'person_required' => 'person_required'
|
||||||
|
} );
|
||||||
|
|
||||||
|
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
|
||||||
|
|
||||||
|
|
||||||
|
1;
|
36
samples/client/petstore/perl/t/AdultTest.t
Normal file
36
samples/client/petstore/perl/t/AdultTest.t
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
=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: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 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;
|
||||||
|
use Test::Exception;
|
||||||
|
|
||||||
|
use lib 'lib';
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
|
||||||
|
use_ok('WWW::OpenAPIClient::Object::Adult');
|
||||||
|
|
||||||
|
# uncomment below and update the test
|
||||||
|
#my $instance = WWW::OpenAPIClient::Object::Adult->new();
|
||||||
|
#
|
||||||
|
#isa_ok($instance, 'WWW::OpenAPIClient::Object::Adult');
|
||||||
|
|
||||||
|
|
||||||
|
done_testing();
|
36
samples/client/petstore/perl/t/ChildTest.t
Normal file
36
samples/client/petstore/perl/t/ChildTest.t
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
=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: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 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;
|
||||||
|
use Test::Exception;
|
||||||
|
|
||||||
|
use lib 'lib';
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
|
||||||
|
use_ok('WWW::OpenAPIClient::Object::Child');
|
||||||
|
|
||||||
|
# uncomment below and update the test
|
||||||
|
#my $instance = WWW::OpenAPIClient::Object::Child->new();
|
||||||
|
#
|
||||||
|
#isa_ok($instance, 'WWW::OpenAPIClient::Object::Child');
|
||||||
|
|
||||||
|
|
||||||
|
done_testing();
|
36
samples/client/petstore/perl/t/HumanTest.t
Normal file
36
samples/client/petstore/perl/t/HumanTest.t
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
=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: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 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;
|
||||||
|
use Test::Exception;
|
||||||
|
|
||||||
|
use lib 'lib';
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
|
||||||
|
use_ok('WWW::OpenAPIClient::Object::Human');
|
||||||
|
|
||||||
|
# uncomment below and update the test
|
||||||
|
#my $instance = WWW::OpenAPIClient::Object::Human->new();
|
||||||
|
#
|
||||||
|
#isa_ok($instance, 'WWW::OpenAPIClient::Object::Human');
|
||||||
|
|
||||||
|
|
||||||
|
done_testing();
|
36
samples/client/petstore/perl/t/PersonTest.t
Normal file
36
samples/client/petstore/perl/t/PersonTest.t
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
=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: \" \\
|
||||||
|
|
||||||
|
The version of the OpenAPI document: 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;
|
||||||
|
use Test::Exception;
|
||||||
|
|
||||||
|
use lib 'lib';
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
|
||||||
|
use_ok('WWW::OpenAPIClient::Object::Person');
|
||||||
|
|
||||||
|
# uncomment below and update the test
|
||||||
|
#my $instance = WWW::OpenAPIClient::Object::Person->new();
|
||||||
|
#
|
||||||
|
#isa_ok($instance, 'WWW::OpenAPIClient::Object::Person');
|
||||||
|
|
||||||
|
|
||||||
|
done_testing();
|
@ -6,3 +6,8 @@ cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mloca
|
|||||||
cpanm --installdeps .
|
cpanm --installdeps .
|
||||||
|
|
||||||
perl tests/01_pet_api.t
|
perl tests/01_pet_api.t
|
||||||
|
perl tests/02_store_api.t
|
||||||
|
perl tests/03_api_factory.t
|
||||||
|
perl tests/04_role.t
|
||||||
|
perl tests/06_inheritance.t
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user