hide generation timestamp for perl (#4614)

This commit is contained in:
wing328 2017-01-21 19:12:51 +08:00 committed by GitHub
parent 1f0ecb5180
commit 4d19fb6b2f
33 changed files with 1598 additions and 281 deletions

View File

@ -27,7 +27,7 @@ fi
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
# complex module name used for testing
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l perl -o samples/client/petstore/perl"
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l perl -o samples/client/petstore/perl -DhideGenerationTimestamp=true"
java $JAVA_OPTS -jar $executable $ags

View File

@ -148,7 +148,7 @@ public class CodegenConstants {
public static final String GENERATE_MODEL_TESTS_DESC = "Specifies that model tests are to be generated.";
public static final String HIDE_GENERATION_TIMESTAMP = "hideGenerationTimestamp";
public static final String HIDE_GENERATION_TIMESTAMP_DESC = "Hides the generation timestamp.";
public static final String HIDE_GENERATION_TIMESTAMP_DESC = "Hides the generation timestamp when files are generated.";
public static final String GENERATE_PROPERTY_CHANGED = "generatePropertyChanged";
public static final String GENERATE_PROPERTY_CHANGED_DESC = "Specifies that models support raising property changed events.";
@ -158,4 +158,5 @@ public class CodegenConstants {
public static final String IGNORE_FILE_OVERRIDE = "ignoreFileOverride";
public static final String IGNORE_FILE_OVERRIDE_DESC = "Specifies an override location for the .swagger-codegen-ignore file. Most useful on initial generation.";
}

View File

@ -109,7 +109,8 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC).defaultValue(Boolean.TRUE.toString()));
cliOptions.add(CliOption.newBoolean(CodegenConstants.ENSURE_UNIQUE_PARAMS, CodegenConstants
.ENSURE_UNIQUE_PARAMS_DESC).defaultValue(Boolean.TRUE.toString()));
cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC)
.defaultValue(Boolean.TRUE.toString()));
}
@ -134,6 +135,14 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
additionalProperties.put("apiDocPath", apiDocPath);
additionalProperties.put("modelDocPath", modelDocPath);
// default HIDE_GENERATION_TIMESTAMP to true
if (!additionalProperties.containsKey(CodegenConstants.HIDE_GENERATION_TIMESTAMP)) {
additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, Boolean.TRUE.toString());
} else {
additionalProperties.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP,
Boolean.valueOf(additionalProperties().get(CodegenConstants.HIDE_GENERATION_TIMESTAMP).toString()));
}
supportingFiles.add(new SupportingFile("ApiClient.mustache", ("lib/" + modulePathPart).replace('/', File.separatorChar), "ApiClient.pm"));
supportingFiles.add(new SupportingFile("Configuration.mustache", ("lib/" + modulePathPart).replace('/', File.separatorChar), "Configuration.pm"));
supportingFiles.add(new SupportingFile("ApiFactory.mustache", ("lib/" + modulePathPart).replace('/', File.separatorChar), "ApiFactory.pm"));

View File

@ -10,7 +10,9 @@ Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/
- API version: {{appVersion}}
- Package version: {{moduleVersion}}
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
@ -312,5 +314,3 @@ Class | Method | HTTP request | Description
{{/isOAuth}}
{{/authMethods}}

View File

@ -43,7 +43,9 @@ has version_info => ( is => 'ro',
default => sub { {
app_name => '{{appName}}',
app_version => '{{appVersion}}',
{{^hideGenerationTimestamp}}
generated_date => '{{generatedDate}}',
{{/hideGenerationTimestamp}}
generator_class => '{{generatorClass}}',
} },
documentation => 'Information about the application version and the codegen codebase version'
@ -108,9 +110,11 @@ sub _build_af {
Automatically generated by the Perl Swagger Codegen project:
=over 4
{{^hideGenerationTimestamp}}
=item Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
=item Build package: {{generatorClass}}
=item Codegen version:

View File

@ -24,6 +24,7 @@ public class PerlClientOptionsProvider implements OptionsProvider {
.put(PerlClientCodegen.MODULE_VERSION, MODULE_VERSION_VALUE)
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, "true")
.put(CodegenConstants.ENSURE_UNIQUE_PARAMS, "true")
.put("hideGenerationTimestamp", "true")
.build();
}

View File

@ -10,8 +10,7 @@ Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-11-16T17:12:17.554+08:00
- Build package: class io.swagger.codegen.languages.PerlClientCodegen
- Build package: io.swagger.codegen.languages.PerlClientCodegen
## A note on Moose
@ -239,8 +238,10 @@ use WWW::SwaggerClient::Object::ApiResponse;
use WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly;
use WWW::SwaggerClient::Object::ArrayOfNumberOnly;
use WWW::SwaggerClient::Object::ArrayTest;
use WWW::SwaggerClient::Object::Capitalization;
use WWW::SwaggerClient::Object::Cat;
use WWW::SwaggerClient::Object::Category;
use WWW::SwaggerClient::Object::ClassModel;
use WWW::SwaggerClient::Object::Client;
use WWW::SwaggerClient::Object::Dog;
use WWW::SwaggerClient::Object::EnumArrays;
@ -256,6 +257,7 @@ use WWW::SwaggerClient::Object::ModelReturn;
use WWW::SwaggerClient::Object::Name;
use WWW::SwaggerClient::Object::NumberOnly;
use WWW::SwaggerClient::Object::Order;
use WWW::SwaggerClient::Object::OuterEnum;
use WWW::SwaggerClient::Object::Pet;
use WWW::SwaggerClient::Object::ReadOnlyFirst;
use WWW::SwaggerClient::Object::SpecialModelName;
@ -285,8 +287,10 @@ use WWW::SwaggerClient::Object::ApiResponse;
use WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly;
use WWW::SwaggerClient::Object::ArrayOfNumberOnly;
use WWW::SwaggerClient::Object::ArrayTest;
use WWW::SwaggerClient::Object::Capitalization;
use WWW::SwaggerClient::Object::Cat;
use WWW::SwaggerClient::Object::Category;
use WWW::SwaggerClient::Object::ClassModel;
use WWW::SwaggerClient::Object::Client;
use WWW::SwaggerClient::Object::Dog;
use WWW::SwaggerClient::Object::EnumArrays;
@ -302,6 +306,7 @@ use WWW::SwaggerClient::Object::ModelReturn;
use WWW::SwaggerClient::Object::Name;
use WWW::SwaggerClient::Object::NumberOnly;
use WWW::SwaggerClient::Object::Order;
use WWW::SwaggerClient::Object::OuterEnum;
use WWW::SwaggerClient::Object::Pet;
use WWW::SwaggerClient::Object::ReadOnlyFirst;
use WWW::SwaggerClient::Object::SpecialModelName;
@ -365,8 +370,10 @@ Class | Method | HTTP request | Description
- [WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- [WWW::SwaggerClient::Object::ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- [WWW::SwaggerClient::Object::ArrayTest](docs/ArrayTest.md)
- [WWW::SwaggerClient::Object::Capitalization](docs/Capitalization.md)
- [WWW::SwaggerClient::Object::Cat](docs/Cat.md)
- [WWW::SwaggerClient::Object::Category](docs/Category.md)
- [WWW::SwaggerClient::Object::ClassModel](docs/ClassModel.md)
- [WWW::SwaggerClient::Object::Client](docs/Client.md)
- [WWW::SwaggerClient::Object::Dog](docs/Dog.md)
- [WWW::SwaggerClient::Object::EnumArrays](docs/EnumArrays.md)
@ -382,6 +389,7 @@ Class | Method | HTTP request | Description
- [WWW::SwaggerClient::Object::Name](docs/Name.md)
- [WWW::SwaggerClient::Object::NumberOnly](docs/NumberOnly.md)
- [WWW::SwaggerClient::Object::Order](docs/Order.md)
- [WWW::SwaggerClient::Object::OuterEnum](docs/OuterEnum.md)
- [WWW::SwaggerClient::Object::Pet](docs/Pet.md)
- [WWW::SwaggerClient::Object::ReadOnlyFirst](docs/ReadOnlyFirst.md)
- [WWW::SwaggerClient::Object::SpecialModelName](docs/SpecialModelName.md)
@ -410,5 +418,3 @@ Class | Method | HTTP request | Description
- **write:pets**: modify pets in your account
- **read:pets**: read your pets

View File

@ -0,0 +1,20 @@
# WWW::SwaggerClient::Object::Capitalization
## Load the model package
```perl
use WWW::SwaggerClient::Object::Capitalization;
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**small_camel** | **string** | | [optional]
**capital_camel** | **string** | | [optional]
**small_snake** | **string** | | [optional]
**capital_snake** | **string** | | [optional]
**sca_eth_flow_points** | **string** | | [optional]
**att_name** | **string** | Name of the pet | [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)

View File

@ -0,0 +1,15 @@
# WWW::SwaggerClient::Object::ClassModel
## Load the model package
```perl
use WWW::SwaggerClient::Object::ClassModel;
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**_class** | **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)

View File

@ -11,6 +11,7 @@ Name | Type | Description | Notes
**enum_string** | **string** | | [optional]
**enum_integer** | **int** | | [optional]
**enum_number** | **double** | | [optional]
**outer_enum** | [**OuterEnum**](OuterEnum.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)

View File

@ -19,6 +19,8 @@ Method | HTTP request | Description
To test \"client\" model
To test \"client\" model
### Example
```perl
use Data::Dumper;
@ -138,6 +140,8 @@ void (empty response body)
To test enum parameters
To test enum parameters
### Example
```perl
use Data::Dumper;
@ -151,7 +155,7 @@ my $enum_header_string_array = []; # ARRAY[string] | Header parameter enum test
my $enum_header_string = 'enum_header_string_example'; # string | Header parameter enum test (string)
my $enum_query_string_array = []; # ARRAY[string] | Query parameter enum test (string array)
my $enum_query_string = 'enum_query_string_example'; # string | Query parameter enum test (string)
my $enum_query_integer = 3.4; # Number | Query parameter enum test (double)
my $enum_query_integer = 56; # int | Query parameter enum test (double)
my $enum_query_double = 1.2; # double | Query parameter enum test (double)
eval {
@ -172,7 +176,7 @@ Name | Type | Description | Notes
**enum_header_string** | **string**| Header parameter enum test (string) | [optional] [default to -efg]
**enum_query_string_array** | [**ARRAY[string]**](string.md)| Query parameter enum test (string array) | [optional]
**enum_query_string** | **string**| Query parameter enum test (string) | [optional] [default to -efg]
**enum_query_integer** | **Number**| Query parameter enum test (double) | [optional]
**enum_query_integer** | **int**| Query parameter enum test (double) | [optional]
**enum_query_double** | **double**| Query parameter enum test (double) | [optional]
### Return type

View File

@ -0,0 +1,14 @@
# WWW::SwaggerClient::Object::OuterEnum
## Load the model package
```perl
use WWW::SwaggerClient::Object::OuterEnum;
```
## 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)

View File

@ -348,7 +348,7 @@ sub test_endpoint_parameters {
# @param string $enum_header_string Header parameter enum test (string) (optional, default to -efg)
# @param ARRAY[string] $enum_query_string_array Query parameter enum test (string array) (optional)
# @param string $enum_query_string Query parameter enum test (string) (optional, default to -efg)
# @param Number $enum_query_integer Query parameter enum test (double) (optional)
# @param int $enum_query_integer Query parameter enum test (double) (optional)
# @param double $enum_query_double Query parameter enum test (double) (optional)
{
my $params = {
@ -383,7 +383,7 @@ sub test_endpoint_parameters {
required => '0',
},
'enum_query_integer' => {
data_type => 'Number',
data_type => 'int',
description => 'Query parameter enum test (double)',
required => '0',
},

View File

@ -0,0 +1,210 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen
#
package WWW::SwaggerClient::Object::Capitalization;
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 the swagger code generator program. Do not edit the class manually.
# REF: https://github.com/swagger-api/swagger-codegen
#
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
# new object
sub new {
my ($class, %args) = @_;
my $self = bless {}, $class;
foreach my $attribute (keys %{$class->attribute_map}) {
my $args_key = $class->attribute_map->{$attribute};
$self->$attribute( $args{ $args_key } );
}
return $self;
}
# return perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# 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 swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_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$/, ('int', 'double', 'string', 'boolean'))) {
return $data;
} else { # hash(model)
my $_instance = eval "WWW::SwaggerClient::Object::$type->new()";
return $_instance->from_hash($data);
}
}
__PACKAGE__->class_documentation({description => '',
class => 'Capitalization',
required => [], # TODO
} );
__PACKAGE__->method_documentation({
'small_camel' => {
datatype => 'string',
base_name => 'smallCamel',
description => '',
format => '',
read_only => '',
},
'capital_camel' => {
datatype => 'string',
base_name => 'CapitalCamel',
description => '',
format => '',
read_only => '',
},
'small_snake' => {
datatype => 'string',
base_name => 'small_Snake',
description => '',
format => '',
read_only => '',
},
'capital_snake' => {
datatype => 'string',
base_name => 'Capital_Snake',
description => '',
format => '',
read_only => '',
},
'sca_eth_flow_points' => {
datatype => 'string',
base_name => 'SCA_ETH_Flow_Points',
description => '',
format => '',
read_only => '',
},
'att_name' => {
datatype => 'string',
base_name => 'ATT_NAME',
description => 'Name of the pet ',
format => '',
read_only => '',
},
});
__PACKAGE__->swagger_types( {
'small_camel' => 'string',
'capital_camel' => 'string',
'small_snake' => 'string',
'capital_snake' => 'string',
'sca_eth_flow_points' => 'string',
'att_name' => 'string'
} );
__PACKAGE__->attribute_map( {
'small_camel' => 'smallCamel',
'capital_camel' => 'CapitalCamel',
'small_snake' => 'small_Snake',
'capital_snake' => 'Capital_Snake',
'sca_eth_flow_points' => 'SCA_ETH_Flow_Points',
'att_name' => 'ATT_NAME'
} );
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
1;

View File

@ -0,0 +1,165 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen
#
package WWW::SwaggerClient::Object::ClassModel;
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");
#
#Model for testing model with \"_class\" property
#
# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
# REF: https://github.com/swagger-api/swagger-codegen
#
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
# new object
sub new {
my ($class, %args) = @_;
my $self = bless {}, $class;
foreach my $attribute (keys %{$class->attribute_map}) {
my $args_key = $class->attribute_map->{$attribute};
$self->$attribute( $args{ $args_key } );
}
return $self;
}
# return perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# 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 swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_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$/, ('int', 'double', 'string', 'boolean'))) {
return $data;
} else { # hash(model)
my $_instance = eval "WWW::SwaggerClient::Object::$type->new()";
return $_instance->from_hash($data);
}
}
__PACKAGE__->class_documentation({description => 'Model for testing model with \"_class\" property',
class => 'ClassModel',
required => [], # TODO
} );
__PACKAGE__->method_documentation({
'_class' => {
datatype => 'string',
base_name => '_class',
description => '',
format => '',
read_only => '',
},
});
__PACKAGE__->swagger_types( {
'_class' => 'string'
} );
__PACKAGE__->attribute_map( {
'_class' => '_class'
} );
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
1;

View File

@ -163,18 +163,27 @@ __PACKAGE__->method_documentation({
format => '',
read_only => '',
},
'outer_enum' => {
datatype => 'OuterEnum',
base_name => 'outerEnum',
description => '',
format => '',
read_only => '',
},
});
__PACKAGE__->swagger_types( {
'enum_string' => 'string',
'enum_integer' => 'int',
'enum_number' => 'double'
'enum_number' => 'double',
'outer_enum' => 'OuterEnum'
} );
__PACKAGE__->attribute_map( {
'enum_string' => 'enum_string',
'enum_integer' => 'enum_integer',
'enum_number' => 'enum_number'
'enum_number' => 'enum_number',
'outer_enum' => 'outerEnum'
} );
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});

View File

@ -0,0 +1,158 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen
#
package WWW::SwaggerClient::Object::OuterEnum;
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 the swagger code generator program. Do not edit the class manually.
# REF: https://github.com/swagger-api/swagger-codegen
#
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the swagger code generator program.
# Do not edit the class manually.
# Ref: https://github.com/swagger-api/swagger-codegen
#
__PACKAGE__->mk_classdata('attribute_map' => {});
__PACKAGE__->mk_classdata('swagger_types' => {});
__PACKAGE__->mk_classdata('method_documentation' => {});
__PACKAGE__->mk_classdata('class_documentation' => {});
# new object
sub new {
my ($class, %args) = @_;
my $self = bless {}, $class;
foreach my $attribute (keys %{$class->attribute_map}) {
my $args_key = $class->attribute_map->{$attribute};
$self->$attribute( $args{ $args_key } );
}
return $self;
}
# return perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# 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 swagger_types to deserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_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$/, ('int', 'double', 'string', 'boolean'))) {
return $data;
} else { # hash(model)
my $_instance = eval "WWW::SwaggerClient::Object::$type->new()";
return $_instance->from_hash($data);
}
}
__PACKAGE__->class_documentation({description => '',
class => 'OuterEnum',
required => [], # TODO
} );
__PACKAGE__->method_documentation({
});
__PACKAGE__->swagger_types( {
} );
__PACKAGE__->attribute_map( {
} );
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
1;

View File

@ -56,8 +56,7 @@ has version_info => ( is => 'ro',
default => sub { {
app_name => 'Swagger Petstore',
app_version => '1.0.0',
generated_date => '2016-11-16T17:12:17.554+08:00',
generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen',
generator_class => 'io.swagger.codegen.languages.PerlClientCodegen',
} },
documentation => 'Information about the application version and the codegen codebase version'
);
@ -121,10 +120,7 @@ WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore
Automatically generated by the Perl Swagger Codegen project:
=over 4
=item Build date: 2016-11-16T17:12:17.554+08:00
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen
=item Build package: io.swagger.codegen.languages.PerlClientCodegen
=item Codegen version:

View File

@ -0,0 +1,33 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the Swagger Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly');
my $instance = WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::ArrayOfArrayOfNumberOnly');

View File

@ -0,0 +1,33 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the Swagger Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::ArrayOfNumberOnly');
my $instance = WWW::SwaggerClient::Object::ArrayOfNumberOnly->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::ArrayOfNumberOnly');

View File

@ -0,0 +1,33 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the Swagger Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::Capitalization');
my $instance = WWW::SwaggerClient::Object::Capitalization->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::Capitalization');

View File

@ -0,0 +1,33 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the Swagger Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::ClassModel');
my $instance = WWW::SwaggerClient::Object::ClassModel->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::ClassModel');

View File

@ -0,0 +1,33 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the Swagger Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::Client');
my $instance = WWW::SwaggerClient::Object::Client->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::Client');

View File

@ -0,0 +1,33 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the Swagger Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::EnumArrays');
my $instance = WWW::SwaggerClient::Object::EnumArrays->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::EnumArrays');

View File

@ -0,0 +1,77 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by Swagger Codegen
# Please update the test cases below to test the API endpoints.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 1; #TODO update number of test cases
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::FakeApi');
my $api = WWW::SwaggerClient::FakeApi->new();
isa_ok($api, 'WWW::SwaggerClient::FakeApi');
#
# test_client_model test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->test_client_model(body => $body);
}
#
# test_endpoint_parameters test
#
{
my $number = undef; # replace NULL with a proper value
my $double = undef; # replace NULL with a proper value
my $pattern_without_delimiter = undef; # replace NULL with a proper value
my $byte = undef; # replace NULL with a proper value
my $integer = undef; # replace NULL with a proper value
my $int32 = undef; # replace NULL with a proper value
my $int64 = undef; # replace NULL with a proper value
my $float = undef; # replace NULL with a proper value
my $string = undef; # replace NULL with a proper value
my $binary = undef; # replace NULL with a proper value
my $date = undef; # replace NULL with a proper value
my $date_time = undef; # replace NULL with a proper value
my $password = undef; # replace NULL with a proper value
my $callback = undef; # replace NULL with a proper value
my $result = $api->test_endpoint_parameters(number => $number, double => $double, pattern_without_delimiter => $pattern_without_delimiter, byte => $byte, integer => $integer, int32 => $int32, int64 => $int64, float => $float, string => $string, binary => $binary, date => $date, date_time => $date_time, password => $password, callback => $callback);
}
#
# test_enum_parameters test
#
{
my $enum_form_string_array = undef; # replace NULL with a proper value
my $enum_form_string = undef; # replace NULL with a proper value
my $enum_header_string_array = undef; # replace NULL with a proper value
my $enum_header_string = undef; # replace NULL with a proper value
my $enum_query_string_array = undef; # replace NULL with a proper value
my $enum_query_string = undef; # replace NULL with a proper value
my $enum_query_integer = undef; # replace NULL with a proper value
my $enum_query_double = undef; # replace NULL with a proper value
my $result = $api->test_enum_parameters(enum_form_string_array => $enum_form_string_array, enum_form_string => $enum_form_string, enum_header_string_array => $enum_header_string_array, enum_header_string => $enum_header_string, enum_query_string_array => $enum_query_string_array, enum_query_string => $enum_query_string, enum_query_integer => $enum_query_integer, enum_query_double => $enum_query_double);
}
1;

View File

@ -0,0 +1,33 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the Swagger Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::HasOnlyReadOnly');
my $instance = WWW::SwaggerClient::Object::HasOnlyReadOnly->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::HasOnlyReadOnly');

View File

@ -0,0 +1,33 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the Swagger Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::List');
my $instance = WWW::SwaggerClient::Object::List->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::List');

View File

@ -0,0 +1,33 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the Swagger Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::MapTest');
my $instance = WWW::SwaggerClient::Object::MapTest->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::MapTest');

View File

@ -0,0 +1,33 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the Swagger Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::NumberOnly');
my $instance = WWW::SwaggerClient::Object::NumberOnly->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::NumberOnly');

View File

@ -0,0 +1,33 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by the Swagger Codegen
# Please update the test cases below to test the model.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 2;
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::Object::OuterEnum');
my $instance = WWW::SwaggerClient::Object::OuterEnum->new();
isa_ok($instance, 'WWW::SwaggerClient::Object::OuterEnum');

View File

@ -0,0 +1,102 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by Swagger Codegen
# Please update the test cases below to test the API endpoints.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 1; #TODO update number of test cases
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::PetApi');
my $api = WWW::SwaggerClient::PetApi->new();
isa_ok($api, 'WWW::SwaggerClient::PetApi');
#
# add_pet test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->add_pet(body => $body);
}
#
# delete_pet test
#
{
my $pet_id = undef; # replace NULL with a proper value
my $api_key = undef; # replace NULL with a proper value
my $result = $api->delete_pet(pet_id => $pet_id, api_key => $api_key);
}
#
# find_pets_by_status test
#
{
my $status = undef; # replace NULL with a proper value
my $result = $api->find_pets_by_status(status => $status);
}
#
# find_pets_by_tags test
#
{
my $tags = undef; # replace NULL with a proper value
my $result = $api->find_pets_by_tags(tags => $tags);
}
#
# get_pet_by_id test
#
{
my $pet_id = undef; # replace NULL with a proper value
my $result = $api->get_pet_by_id(pet_id => $pet_id);
}
#
# update_pet test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->update_pet(body => $body);
}
#
# update_pet_with_form test
#
{
my $pet_id = undef; # replace NULL with a proper value
my $name = undef; # replace NULL with a proper value
my $status = undef; # replace NULL with a proper value
my $result = $api->update_pet_with_form(pet_id => $pet_id, name => $name, status => $status);
}
#
# upload_file test
#
{
my $pet_id = undef; # replace NULL with a proper value
my $additional_metadata = undef; # replace NULL with a proper value
my $file = undef; # replace NULL with a proper value
my $result = $api->upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file);
}
1;

View File

@ -0,0 +1,64 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by Swagger Codegen
# Please update the test cases below to test the API endpoints.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 1; #TODO update number of test cases
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::StoreApi');
my $api = WWW::SwaggerClient::StoreApi->new();
isa_ok($api, 'WWW::SwaggerClient::StoreApi');
#
# delete_order test
#
{
my $order_id = undef; # replace NULL with a proper value
my $result = $api->delete_order(order_id => $order_id);
}
#
# get_inventory test
#
{
my $result = $api->get_inventory();
}
#
# get_order_by_id test
#
{
my $order_id = undef; # replace NULL with a proper value
my $result = $api->get_order_by_id(order_id => $order_id);
}
#
# place_order test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->place_order(body => $body);
}
1;

View File

@ -0,0 +1,98 @@
=begin comment
Swagger 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
Contact: apiteam@swagger.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
=end comment
=cut
#
# NOTE: This class is auto generated by Swagger Codegen
# Please update the test cases below to test the API endpoints.
# Ref: https://github.com/swagger-api/swagger-codegen
#
use Test::More tests => 1; #TODO update number of test cases
use Test::Exception;
use lib 'lib';
use strict;
use warnings;
use_ok('WWW::SwaggerClient::UserApi');
my $api = WWW::SwaggerClient::UserApi->new();
isa_ok($api, 'WWW::SwaggerClient::UserApi');
#
# create_user test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->create_user(body => $body);
}
#
# create_users_with_array_input test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->create_users_with_array_input(body => $body);
}
#
# create_users_with_list_input test
#
{
my $body = undef; # replace NULL with a proper value
my $result = $api->create_users_with_list_input(body => $body);
}
#
# delete_user test
#
{
my $username = undef; # replace NULL with a proper value
my $result = $api->delete_user(username => $username);
}
#
# get_user_by_name test
#
{
my $username = undef; # replace NULL with a proper value
my $result = $api->get_user_by_name(username => $username);
}
#
# login_user test
#
{
my $username = undef; # replace NULL with a proper value
my $password = undef; # replace NULL with a proper value
my $result = $api->login_user(username => $username, password => $password);
}
#
# logout_user test
#
{
my $result = $api->logout_user();
}
#
# update_user test
#
{
my $username = undef; # replace NULL with a proper value
my $body = undef; # replace NULL with a proper value
my $result = $api->update_user(username => $username, body => $body);
}
1;